LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash shell script (http://www.linuxquestions.org/questions/linux-newbie-8/bash-shell-script-189050/)

globeTrotter 06-02-2004 08:43 PM

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

ranger_nemo 06-02-2004 08:51 PM

Give an example of what works and what doesn't.

globeTrotter 06-02-2004 09:02 PM

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

ranger_nemo 06-02-2004 09:16 PM

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.

globeTrotter 06-02-2004 09:24 PM

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

claudius753 06-03-2004 05:07 AM

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 :)


All times are GMT -5. The time now is 09:28 PM.