The echo command ends with a line break by default. To suppress this, you can set the control character \c at the end of the respective output.
echo command in linux is used to display line of text/string that are passed as an argument . This is a built in command that is mostly used in shell scripts and batch files to output status text to the screen or a file. Syntax : echo [option] [string]
Which command is used as an alternative to echo command? Explanation: printf command is available on most UNIX systems and it behaves much like a substitution for echo command. It supports many of the formats which are used by C's printf function.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With