LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-31-2004, 02:19 PM   #1
linuxboy69
Member
 
Registered: Oct 2003
Distribution: Redhat 9
Posts: 138

Rep: Reputation: 15
Shell Scripting Problem


what is the syntax for a line break? I thought that in linux it was \r\n and it works when I write it into a normal file from php but when i use scp to copy it to a remote server, it shows that data without line breaks and even has a "^M" where the line break is whatever that is suppose to be.

Any help would be greatly appreciated.
 
Old 03-31-2004, 02:21 PM   #2
czarherr
Member
 
Registered: Sep 2003
Location: Suwon, Korea
Distribution: Slackware 13
Posts: 288

Rep: Reputation: 32
i just use \n
 
Old 03-31-2004, 07:36 PM   #3
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
By default, echo doesn't convert \n or \t, but you can use the -e option:

Code:
echo -e "qwerty\n\uiop\n\tIntented"
Or you can use printf.

Code:
printf "qwerty\n\uiop\n\tIntented"
Or:

[CODE]printf "%b\n" "qwerty\n\uiop\n\tIndented"{/CODE]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
Shell scripting problem for importing Firefox files montylee Programming 6 06-03-2005 01:52 AM
shell scripting: variable problem XST1 Programming 7 01-30-2005 01:45 PM
another cgi and shell scripting problem + webserver prinski Programming 6 04-08-2004 04:25 PM
problem in shell scripting visu Linux - Newbie 4 01-06-2004 04:16 PM


All times are GMT -5. The time now is 12:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration