问题
What is the use for the -n
flag with the echo command in Linux?
echo -n
回答1:
man echo
-n Do not print the trailing newline character. This may also be achieved by appending `\c' to the end of the string, as is done
by iBCS2 compatible systems. Note that this option as well as the effect of `\c' are implementation-defined in IEEE Std
1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. Applications aiming for maximum portability are strongly encouraged to
use printf(1) to suppress the newline character.
Many built-in commands to Linux have a man
page (e.g. man ls
), which is a great way to look at the man
ual without having to search online.
来源:https://stackoverflow.com/questions/20499578/n-option-with-echo-command-in-linux