I have the following code snippet:
#!/bin/sh
if [ $1 = hi ]; then
echo 'The first argument was "hi"'
else
echo -n 'The first argument was not "hi" -- '
echo It was '"'$1'"'
fi
And I don't know what the flag -n after echo in the else statement stands for, does anyone knows the answer?
Thank you very much!
echo
might be a built-in (e.g. in Bash, Zsh). So while there may be aman
-page for/bin/echo
or so,help echo
would be the way to go in that case (i.e. Bash only). Andtype echo
can be used to find out which one your shell uses (built-in or command etc ..., i.e. in both Bash and Zsh again). – 0xC0000022L Apr 12 '20 at 21:16echo hi
and (2)echo -n hi
. Doesecho -n
behave differently? – Andy Dalton Apr 12 '20 at 23:08