LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-02-2004, 08:43 PM   #1
globeTrotter
Member
 
Registered: Feb 2004
Location: Townsville, Queensland, Oz
Distribution: Red Hat 9
Posts: 107

Rep: Reputation: 15
bash shell script


Hi

i've been trying to get into shell scripting to make life easier at the command line. i bought a book (Beginning Linux programming 3rd ed) and downloaded all the source for the book from the internet. the prob is none of the shell scripts work. herein lies the dilemma. when i write the scripts myself. they work!!!! with all things being equal, owner, group, permissions, directory etc, i get this message.
: bad interpreter : no such file or directory
when i run the downloaded scripts. mine work just fine. The PATH is set okay by the way.

any ideas??????
stumped
GT
 
Old 06-02-2004, 08:51 PM   #2
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Give an example of what works and what doesn't.
 
Old 06-02-2004, 09:02 PM   #3
globeTrotter
Member
 
Registered: Feb 2004
Location: Townsville, Queensland, Oz
Distribution: Red Hat 9
Posts: 107

Original Poster
Rep: Reputation: 15
Hi R Nemo

thanks for giving it a go. but it doesnt matter what the scripts look like. line for line, word for word, space for space. Mine seem to work but the downloaded ones dont!!! i'm fairly conversant in C/C++, so have to say the syntax is correct, as it shows when my code works. i was thinking that maybe the shell is'nt reading into the file to begin with. i was hoping all i would have to do is unset/configure something that has to do with downloaded files from outside of the scripts themselves. Hhhhmmmmmmm!!! what do you think? give me your thoughts anyway, maybe we can come up with something.

still stumped
GT
 
Old 06-02-2004, 09:16 PM   #4
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Could be the line-end difference between Unix and DOS... One has a line-feed + carriage-return, the other just has a line-feed. I think. I don't remember which is which.

Try running "dos2unix scriptname.sh" on one of the downloaded scripts. You might have to reset the permissions after that.
 
Old 06-02-2004, 09:24 PM   #5
globeTrotter
Member
 
Registered: Feb 2004
Location: Townsville, Queensland, Oz
Distribution: Red Hat 9
Posts: 107

Original Poster
Rep: Reputation: 15
Hi R Nemo

mate, your a genius. i ran the dos2unix on two of the scripts, and they now work. i'll have to write that little utility down. very useful
Thanx again

GT
 
Old 06-03-2004, 05:07 AM   #6
claudius753
Member
 
Registered: Jan 2004
Distribution: Mac OS X 10.6.4 "Snow Leopard", Win 7, Ubuntu 10.04
Posts: 322

Rep: Reputation: 31
Well there's a good project for you to start out scripting.

Write a script that automatically runs that command on the scripts you downloaded
 
  


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
help with bash shell script !! taiwf Linux - Newbie 5 06-11-2006 06:07 PM
Bash shell script moodupani Linux - General 2 09-01-2005 06:14 AM
Bash Shell script bd1308 Linux - Hardware 9 08-22-2005 05:38 PM
bash shell script naka0naka Linux - Newbie 7 05-28-2004 03:06 PM
bash/shell script mikis Programming 2 10-14-2003 11:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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