Home

shellTrue

ShellTrue is a term used in some discussions of shell scripting to denote a portable construct that yields a boolean true value in shell environments. It is not a standard feature of POSIX shells, and there is no official specification. Instead, it refers to a small utility, function, or convention that can be used to obtain a truth value in a way that is easy to consume in scripts across different shells.

A typical implementation is a tiny script or function that exits with status 0, indicating success, and

Because ShellTrue lacks standardization, practitioners often prefer native tools such as the true command (which exits

In practice, the concept functions best as a documentation or teaching aid to discuss how different shells

See also: true command; test; POSIX shell; boolean logic in shell scripting.

may
optionally
print
a
canonical
string
such
as
"true"
to
standard
output.
The
exact
behavior
varies:
some
variants
print
the
word
true,
others
produce
no
output
and
rely
solely
on
the
exit
status.
The
value
can
be
used
in
conditionals,
for
example
"if
shellTrue;
then
...;
fi",
or
captured
in
a
variable
with
"val=$(shellTrue)"
and
then
compared.
with
status
0
and
emits
no
output)
or
explicit
tests
in
POSIX
shells
for
portability.
A
textual
wrapper
can
help
unify
interfaces
when
a
script
expects
a
string,
but
it
introduces
an
extra
dependency
and
possible
portability
concerns.
treat
booleans
and
command
success
versus
textual
values.