Configure HTML/JavaScript

Monday, November 26, 2012

^M: not found error in unix

^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.....


4 comments:

  1. the easist command to remove control-M character from the unix file is

    command: % sed -e "s/^M//" file.sh > file.sh

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. t see if there is any control-M character os there or not it. the command will cat -v filename.sh

    ReplyDelete