Best Answer: How Do You Add a New Line Character in Unix Shell Script?
Contents If You Don’t Want to Use Echo Repeatedly to Create New Lines in Your Shell Script, Then You Can Use the N Character. the N Is a Newline Character for...
Contents
If you don’t want to use echo repeatedly to create new lines in your shell script, then you can use the n character. The n is a newline character for Unix-based systems; it helps to push the commands that come after it onto a new line.
How do I add a new line in a bash script?
Uses of n in Bash
- String in double quote: echo -e “This is First Line nThis is Second Line”
- String in single quote: echo -e ‘This is First Line nThis is Second Line’
- String with $ prefix: echo $’This is First Line nThis is Second Line’
- Using printf command: printf “This is First Line nThis is Second Line”
20 апр. 2018 г.
How do I add a new line character to a string?
In Windows, a new line is denoted using “rn”, sometimes called a Carriage Return and Line Feed, or CRLF. Adding a new line in Java is as simple as including “n” , “r”, or “rn” at the end of our string.