2015-07-01 19:41:00 -0600, Bob Proulx:
[...]
$ a= ; echo $s | wc -l
1
[...]
No. Should be 1. You have forgotten about the newline at the end of
the command. The echo will terminate with a newline.
[...]
Leaving a variable unquoted will also cause the shell to apply
the split+glob
tag 20954 + notabug
close 20954
thanks
tele wrote:
Hi!
Hi!
From terminal:
$ a= ; echo $s | wc -l
1
Do you mean $a instead of $s? Either way is the same though assuming
$s is empty too.
- Yes, my mistake :-)
Should be 0 , yes ?
No. Should be 1. You have forgotten about the
tele wrote:
echo gives in new line,
Yes.
echo -n subtracts 1 line,
echo -n is non-portable and shouldn't be used.
echo -n suppresses emitting a trailing newline.
Note that in both of these cases you are using the shell's internal
builtin echo and not the coreutils echo. They behave the