LinuxQuestions.org
Register a domain and help support LQ
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 05-04-2009, 05:16 PM   #1
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 385

Rep: Reputation: 33
csh Shell Script: String Concatenation, how do i add a new line character?


Hello again,


Inside a loop i'm populating a string variable. Because csh doesn't have very good support for arrays I thought of doing this. I want to add a new line character to the end of the concatenation each time the loop iterates. Then at the end print this variable out.

I tried "\n" and some resources said it was just a "\". Neither work. What am I doing wrong?



Thanks again,
vxc
 
Old 05-04-2009, 07:51 PM   #2
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 385

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by vxc69 View Post
Hello again,


Inside a loop i'm populating a string variable. Because csh doesn't have very good support for arrays I thought of doing this. I want to add a new line character to the end of the concatenation each time the loop iterates. Then at the end print this variable out.

I tried "\n" and some resources said it was just a "\". Neither work. What am I doing wrong?



Thanks again,
vxc
The concept of shell scripting is just hitting me. My problem was solved using a temporary file and using the > and >> pipe symbols.

Thanks anyway guys,
 
  


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
C++ string object; add whitespace controll character sureshkellemane Programming 5 01-13-2009 06:31 PM
How to identify a line and replace another string on that line using Shell script? Sid2007 Programming 10 10-01-2007 08:49 PM
Shell string concatenation Quakeboy02 Programming 4 04-26-2007 11:11 AM
how to add script files to /etc/csh.login Enigmatic_Desires Linux - Newbie 2 06-22-2005 06:45 AM


All times are GMT -5. The time now is 11:35 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