Thursday, January 13, 2011

[Shell Script x boleh nak execute]

Error masa run :

[oracle@ccms ~]$ ./clear_logs.sh
-bash: ./clear_logs.sh: /bin/sh^M: bad interpreter: No such file or directory



Reason  : The script could have opened in some editor and not in unix format.

Solution : Please use dos2unix command to convert the script into unix format


          command : $ dos2unix <your_file.sh>


e.g.:
[oracle@ccms ~]$ dos2unix clear_logs.sh 
converting file clear_logs.sh to UNIX format ...
[oracle@ccms ~]$




After that, you can try to run your sh file again  


*Note : Make sure Rights for that file is -rwxr-xr-x

No comments:

Post a Comment