In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the echo command in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Detailed explanation of Linux:echo command
Used for string output
Format
Echo string
Use echo to achieve more complex output format control 1. Display the normal string: echo "It is a test" the double quotation marks here can be omitted, the following command is consistent with the above example: echo It is a test2. Displaying the escape character echo "\" It is a test\ "" will result in: "It is a test" similarly, double quotes can also be omitted by 3. The display variable read command reads one line from the standard input and assigns the value of each field on the input line to the shell variable #! / bin/shread name echo "$name It is a test". The above code is saved as the variable that test.sh,name receives the standard input. The result will be: [root@www ~] # sh test.shOK # standard input OK It is a test # output 4. Display the newline echo-e "OK!\ n" #-e to enable the escape echo "It it a test" output result: OK, it it a test5. Show no line break #! / bin/shecho-e "OK!\ c" #-e turn on escape\ c No line break echo "It is a test" output result: OK! It is a test
Transfer of meaning
\ a sound of warning
\ b Delete the previous character
\ c finally, no newline symbol is added.
\ f Wrap line, but the cursor remains in its original position
\ nWrap and the cursor moves to the beginning of the line
\ r move the cursor to the beginning of the line, but do not wrap
\ t insert tab
\ v is the same as\ f
\ insert\ character
\ nnn inserts ASCII characters represented by nnn (octal)
6. The display result is directed to the file echo "It is a test" > myfile7. Output the string as is, without escaping or taking variables (in single quotes) echo'$name\ "'output result: $name\" 8. Display the command execution results echo `date` the results will show the current date Thu Jul 24 10:08:46 CST 2014 above is "how to use echo commands in Linux" all the content of this article, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.