LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash Script for a newline (https://www.linuxquestions.org/questions/programming-9/bash-script-for-a-newline-253281/)

olefemmy 11-10-2004 12:14 PM

Bash Script for a newline
 
Hello,

I am trying to write a bash script which should take some characters to a new line. I tried using \n for the feeder but this refused to work out. Can somebody help me out asap.

Thanks

wapcaplet 11-11-2004 11:16 PM

Something like this?

Code:

echo -e "Some text\nSome text on a new line"
The \n is the newline, and the -e option allows the \n to be interpreted as a newline (by default, I think it is printed literally). For other output builtins, it may be different; for printf, I think you need to include the %b format option to allow backslash-escaped characters to be interpreted that way. The manual page for bash might be worth a look, too.

I hope this helps!


All times are GMT -5. The time now is 03:21 PM.