^M: not found error in unix
I was executing a shell script file through the nohup command. while executing the file i got the ^M: not found error in unix command prompt.
Then i started searching why i am getting this error. after making several googling, i got to know that this is due to i created this shell script file in windows (eclipse) OS.
Normally when we create any file in windows and move/upload it to unix it append ^M in every line in the unix platform. it causes the error. now you need to remove these ^M character from the shell script to work it properly. You can do that i several ways
1. opening the script file VI editor and manually removing these extra charactors
2. using dos2unix command
3.....
the easist command to remove control-M character from the unix file is
ReplyDeletecommand: % sed -e "s/^M//" file.sh > file.sh
This comment has been removed by the author.
ReplyDeletet see if there is any control-M character os there or not it. the command will cat -v filename.sh
ReplyDeleteits cat -v filename.sh
Deletenot working for me.. i am using .ksh file
ReplyDelete