The method of using newline characters in Bash Shell
Editor to share with you how to use newline characters in Bash Shell, 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 learn about it!
Let's first take a look at the orders.
Use the following command to print newline characters in the bash shell script.
Printf "first line\ nsecond line\ n"
The usage of\ nin bash
\ n (newline) is used as a newline character for Unix-based systems. The following is a simple example of using newline characters in a bash shell script.
String in double quotation marks:
$echo-e "This is First Line\ nThis is Second Line"
String in single quotation marks:
$echo-e'This is First Line\ nThis is Second Line'
String with $prefix:
$echo $'This is First Line\ nThis is Second Line'
Use the printf command:
$printf "This is First Line\ nThis is Second Line" above is all about the method of using newline characters in Bash Shell. 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!