view raw
Vaishali Modi Vaishali Modi - 11 months ago 28
Linux Question

-n option with ECHO command in Linux

what is the use of -n option with ECHO command in Linux.

echo -n

Please give me answer with detail description.


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 manual without having to search online.