links: |- back -|- index -|- home -|
The command 'echo' is to output a string to stdout, for the user to see some results... and it can be redirected to a file...
This 'echo' command varies, depending on the specific 'shell' running, but is generally.
~$ echo "This string" [> out_file]
For example to output '\n' in the 'bash' shell, then -
~$ echo "No new \\n line"
will show 'No new \n line'.
But in the standard shell, 'sh', this has to be double escaped, like
~$ echo "No new \\\n line"
to show the same thing.
As the manual shows, BUT it does depend on which shell, and which 'echo' is in your system -
~$ echo [OPTION] [STRING]
So an 'echo' without [option] or [string] will just out a new line.
Note: This only appears to work in the 'bash' shell -
#!/bin/bash - and NOT in the 'sh' shell!
From : http://linux.about.com/library/cmd/blcmdl1_echo.htm
options are :-
-n | do not output the trailing newline |
---|---|
-e | enable interpretation of the backslash-escaped characters listed below, like color sequences... |
-E | disable interpretation of those sequences in STRINGs |
--help | display this help and exit |
--version | output version information and exit |
Without -E, the following sequences are recognized and interpolated:
\NNN | the character whose ASCII code is NNN (octal) |
---|---|
\\ | backslash |
\a | alert (BEL) |
\b | backspace |
\c | suppress trailing newline |
\e | ANSI ESC character - for say color sequences - red '\e[1;31m', normal '\e[0m', etc |
\f | form feed |
\n | new line |
\r | carriage return |
\t | horizontal tab |
\v | vertical tab |