Difference between revisions of "Echo"
From Linuxintro
imported>ThorstenStaerk |
imported>ThorstenStaerk |
||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
tweedleburg:~ # cat file | tweedleburg:~ # cat file | ||
hello world | hello world | ||
+ | |||
+ | = Show all characters = | ||
+ | To show all ascii characters you can use the following [[command]]: | ||
+ | for l in $(seq 0 1 7); do for i in $(seq 0 1 7); do for n in $(seq 0 1 7); do \ | ||
+ | echo -en "\0${l}${i}${n} "; done; done; done | ||
+ | |||
+ | = Show hexadecimal characters = | ||
+ | echo -e "\x41" | ||
+ | A | ||
= See also = | = See also = | ||
* [[sHell skripting tutorial]] | * [[sHell skripting tutorial]] |
Latest revision as of 21:02, 6 January 2013
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
Show all characters
To show all ascii characters you can use the following command:
for l in $(seq 0 1 7); do for i in $(seq 0 1 7); do for n in $(seq 0 1 7); do \ echo -en "\0${l}${i}${n} "; done; done; done
Show hexadecimal characters
echo -e "\x41" A