Difference between revisions of "Echo"


From Knoppix Documentation Wiki
Jump to: navigation, search
(Init from PHPWiki)
 
(Examples)
 
Line 7: Line 7:
 
   
 
   
 
  echo 'Show me the money' > cash.out
 
  echo 'Show me the money' > cash.out
This version shows how a [[echo]] can be used to create files.  The output of [[echo]] is sent to the file called '''cash.out'''.  The greater than sign, > is used with a technique called [[redirection]].
+
This version shows how [[echo]] can be used to put text into a file.  The greater than sign > is a shell [[redirection]], which causes the output of a given command to be redirected into the specified file.  The output of [[echo]] is thus redirected into the file named '''cash.out'''.   
 
   
 
   
 
  echo ^O^G
 
  echo ^O^G

Latest revision as of 02:53, 1 October 2005

echo is a Linux bash shell scripting command. Other shell scripting languages also have an echo command. The purpose of the command is to display text in your scripts.

Examples

echo $PATH

This version is used to look at the contents of a shell varaible. In this case, the contents of the PATH variable are displayed.

echo 'Show me the money' > cash.out

This version shows how echo can be used to put text into a file. The greater than sign > is a shell redirection, which causes the output of a given command to be redirected into the specified file. The output of echo is thus redirected into the file named cash.out.

echo ^O^G

echo can be used to set terminal settings. If you use the hat character, shift 6 key on US English keyboards, this sequence will not reset a foobared terminal. The hat character repersents the escape character, ASCII 27. The control key and [ key are used to create the escape character.