BASH Script - command not found!!
Hello all,
I get this error: [root]# sh 87.sh filesToConvert.txt : command not found '7.sh: line 17: syntax error near unexpected token `{ '7.sh: line 17: `processLine(){ It refers to this part: Code:
# User define Function (UDF) Thanks all |
change it to
Code:
processLine() |
Hi acid_kewpie. Thanks for the reply. I did as you said, now I get:
Code:
: command not found |
Two questions:
1) did you write the script on a Windows machine? 2) Can you give a real example of a call to the processLine function? |
Quote:
Quote:
Code:
while read line |
Let's focus on the first question. If you wrote the script on a windows machine, then it may contain some weird character which is not managed by the shell. First try to run the dos2unix command:
Code:
dos2unix 87.sh |
Quote:
A weird thing is if I run my script like ./87.sh i get the following: Code:
-bash: ./87.sh: /bin/bash^M: bad interpreter: No such file or directory |
That's it. It is the "carriage return" plus "newline" character used by windows instead of the "newline" used by the unix systems. Most likely you don't see that sequence of character in your editor, but it's there. Check if you can install the dos2unix utility
Code:
yum install dos2unix |
Haha Genius! :)
It worked, that is the most useful command ever for a windows/linux noob! Thank you very much! |
Maybe a quick question if you are still arround. :)
I use eval for the lines I parse from the text file. It runs an ffmpeg command, is there a way I can supress the output of the command I call (ffmpeg)? If its too much work, dont worry. I will just save the stuff I need to a text file! |
Well, just use redirection. If you want to completely throw away the output, redirect it to /dev/null (and eventually the standard error as well) otherwise save it to a file, for example
Code:
eval blah blah blah > /dev/null 2>&1 # stdout and stderr lost |
Ah ok, I see. Thank you once again! :)
|
You're welcome! :)
|
All times are GMT -5. The time now is 04:09 PM. |