Another simple question - cannot execute scripts
When I try to execute any of a number of scripts on my system (RHEL 5 - i386), I get the following error message:
-bash: ./simple_script: /bin/bash^M: bad interpreter: No such file or directory What does this error mean and more importantly, how do I correct this issue? Thanks! --Steve |
Quote:
You can use vi to edit the file and remove the "^M" characters, or run dos2unix if it's available in your distro. |
At the start of your script you have
#! /bin/bash^M get rid of the ^M ... :) It looks like you created the script on a windows machine and/or with a windows text editor. Is this correct? Windows end-of-line is a carriage-return followed by a line-feed. In unix, it is just a line-feed. The ^M is a carriage return. The dos2unix utility will strip these for you. |
...ahhh ...tripped-up by the old non-printed characters trick. %-)
I figured it was something along these lines but when I cat the scripts on my Linux host, the shebang line looked normal. ...anyway, < THANK YOU VERY MUCH > for your help with this! ...especially for the suggestion to use dos2unix! I've never used this utility before but it was a life-saver in this case as it allowed me to clean-up a whole directory full of scripts in batch! THANKS! --Steve |
All times are GMT -5. The time now is 12:01 AM. |