LinuxQuestions.org
Review your favorite Linux distribution.
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 06-28-2007, 11:15 AM   #1
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
Bash scripting new line interpretation


Hello and mtia.
basically I am calling a system command from an asterisk dialplan.

Code:
System(/bin/echo -e "From: ${CALLERID(all)} \n To: Test" | /usr/bin/mutt -a /var/spool/asterisk/fax/1182976018.452.tif -s "FAX - From ${CALLERID(all)}" "${FAXTOEMAILADDRESS}")
I also tried like this.
Code:
System(/bin/echo -e "From: ${CALLERID(all)}" \n "To: Test" | /usr/bin/mutt -a /var/spool/asterisk/fax/1182976018.452.tif -s "FAX - From ${CALLERID(all)}" "${FAXTOEMAILADDRESS}")
I always receive this in the body:
From: <phone numbers> n To: Test
Never a new line. Any ideas?

mtia
 
Old 06-28-2007, 02:07 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,697
Blog Entries: 54

Rep: Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962
Escape the backslash like \\\? What shows if you output to tmpfile for testing purposes? Else is this really a Bash problem?
 
Old 06-28-2007, 02:26 PM   #3
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Original Poster
Rep: Reputation: 30
Newlines do appear fine in testing, I had made sure to test that before I posted. They do not in the above example, however that is now a moot point as a one line body is fine in the sending of the mail.


Thanks for the response anyways unSpawn.
 
Old 06-28-2007, 05:10 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,697
Blog Entries: 54

Rep: Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962
Ok, Np.....
 
Old 06-29-2007, 05:34 PM   #5
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 47
Quote:
Originally Posted by unSpawn
Ok, Np.....
I guess that problem was NP-Easy
 
  


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
BASH: read every line in the files and use the line as parameters as another program tam3c36 Programming 10 12-07-2010 02:42 PM
Shell scripting: print first line and last line only Micro420 Programming 5 05-20-2007 07:26 PM
how to change some text of a certain line of a text file with bash and *nix scripting alred Programming 6 07-10-2006 12:55 PM
Bash scripting - add a character to a line. welby Programming 1 01-14-2004 11:09 AM
linux scripting help needed read from file line by line exc commands each line read atokad Programming 4 12-26-2003 11:24 PM


All times are GMT -5. The time now is 06:38 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration