Difference between revisions of "Echo"

From Linuxintro
imported>ThorstenStaerk
(Created page with "echo is a command to write something. By default this goes to stdout which by default goes to the console. Here is an example: tweedleburg:~ # echo "hello world" he...")
 
imported>ThorstenStaerk
Line 1: Line 1:
echo is a [[command]] to write something. By default this goes to [[stdout]] which by default goes to the [[console]]. Here is an example:
+
echo is a [[command]] to write something. By default this goes to [[stdout]] which by default goes to the [http://simple.wikipedia.org/wiki/Command_Line_Interface console]. Here is an example:
 
  tweedleburg:~ # echo "hello world"
 
  tweedleburg:~ # echo "hello world"
 
  hello world
 
  hello world

Revision as of 21:22, 17 December 2011

echo is a command to write something. By default this goes to stdout which by default goes to the console. Here is an example:

tweedleburg:~ # echo "hello world"
hello world

you can also output variables:

tweedleburg:~ # export name="Linus"
tweedleburg:~ # echo $name
Linus

for more info on this, see shell programming. As with every program that outputs text, you can redirect the output to a file like this:

tweedleburg:~ # echo "hello world" > file
tweedleburg:~ # cat file
hello world