Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-29-2011, 01:22 PM   #1
LQ Newbie
Registered: Oct 2011
Posts: 2

Rep: Reputation: Disabled
How to call a script from a script?

My bash-script is this one:

./flow3 kickstart:model Flow.Test MyClass title:string
if I append a new line to this script, e.g. to make it look like
./flow3 kickstart:model Flow.Test MyClass title:string
./flow3 kickstart:model Flow.Test MyClass2 number:integer
then title:string[NEWLINE] is passed as an argument instead of title:string.
how do I fix this?
Old 10-29-2011, 01:35 PM   #2
Registered: Aug 2007
Distribution: openSUSE 12.1
Posts: 96

Rep: Reputation: 24
hmmm, if i have this:
echo "#"$1"#"
echo "#"$2"#"
and this:

./testje 1 2
./testje 3 4
than, when doing ./testje2, i will get:
which seems exactly as you expect....
Old 10-29-2011, 01:47 PM   #3
LQ Newbie
Registered: Oct 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Sorry, but how does this help?
Old 10-29-2011, 03:05 PM   #4
Senior Member
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Linux Mint, Ubuntu
Posts: 1,595

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
It rules out bash as the problem.
Old 10-30-2011, 12:11 AM   #5
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
The symptom would happen if the script had edited using a Windows editor in which case the new line would have been made by ASCII "carriage return" followed by "line feed". Linux uses only "line feed" for a new line so bash would take the "carriage return" as the last character of the line. Wikipedia.

If that is what's happening, for a small file like this the easiest solution would be to use a Linux editor that shows the unwanted character and delete it. Alternatively you may have dos2unix or fromdos commands available or you could do it in an awk one liner:
awk '{ sub("\r$", ""); print }' flow3 > flow3.fixed


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
linux-backtrack- script that call to another script? yogevmi Programming 3 09-17-2010 05:35 AM
ssh - using variables in call to start remote script from local script babag Linux - Networking 2 06-03-2008 04:50 PM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
call another script and have the inital script exit mjtice Programming 1 09-11-2005 11:54 AM
My shell script can't seem to call another script kakho Programming 3 04-17-2004 09:21 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:06 AM.

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