Shell echo Command
Display Normal string:
echo "I am cat_crazy."
Note: The double quotes here can be omitted
Show escape characters:
If you want to output quotes, the * number needs to be escaped to output, as follows
echo \ "I am cat_crazy\"
The output is "I'm cat_crazy."
Note: Quotes need to be escaped to output
Display variables:
Name= "Cat_crazy"
Echo $name
Show line breaks:
Echo-e "Hello \ n" #-e open escape \ n line break
echo "Cat_crazy"
The output is:
Hello
Cat_crazy
Note: There is a blank line in the middle
Show No Line breaks
Echo-e "Hello \c" #-e Open escape \c No Line break
echo "Cat_crazy"
Output Result:
Hello Cat_crazy
Show results directed to a file
echo "Cat_crazy" > MyFile
Note: This results will be saved directly to the MyFile file, the MyFile file if there will be overwritten if there is no create
Output characters as-is, without escaping or taking variables (using single quotes)
echo ' $name \ '
The output is $name \ "
Show command execution results:
echo ' Data '
Output Results January 17, 2017 Tuesday 13:23:35 CST
Note: command to use anti-quote wrapping
Shell Scripting Learning (iii)