LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-10-2004, 12:14 PM   #1
olefemmy
LQ Newbie
 
Registered: Nov 2004
Posts: 4

Rep: Reputation: 0
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
 
Old 11-11-2004, 11:16 PM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
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!

Last edited by wapcaplet; 11-11-2004 at 11:18 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script moodupani Programming 3 08-30-2005 07:31 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-05-2003 11:58 PM
bash script digit Programming 3 06-10-2003 10:24 AM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration