Menu

#11 Shell scripts need to be UNIX-style to execute

open
nobody
None
5
2014-01-10
2008-08-30
brabax
No

There seems to be an bug in the format of linux start scrips:

When I try to start extract.sh :

bash: ./metadata.sh: /bin/sh^M: bad interpreter: No such file or directory

After converting the shell scrips with the following utility I was able to start them:

dos2unix extract.sh
dos2unix metadata.sh

--
more detailed description on:

http://www.gnulinuxclub.org/index.php?option=com_content&task=view&id=339&Itemid=49

If the file has been edited on a Windows machine it can sometimes Add CR/LF (VM) characters on the end of each line, so #!/bin/sh becomes #!/bin/shVM and as the ctrl-v/ctrl-m characters are special, and hidden by default on most editors, it can create a really hard to find problem. To remove the extra CR characters that UNIXish machines don't like, simply use the dos2unix command:

* []dos2unix <infile> <outfile>

If your OS doesn't have dos2unix, then you can use:

* []cat <infile> | tr -d ``\r'' > <outfile>

Discussion

  • Alkhimey

    Alkhimey - 2012-06-15

    I would like to confirm that as of the latest version of this program the issue still persists. Fixing it should not be problematic, all you have to do is to run dos2unix before packaging the software. This will save a lot of time to clewless users.

     
  • Nobody/Anonymous

    Sweet blog! I found it while searching on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I've been trying for a while but I never seem to get there! Thank you
    north face jackets for women http://ebanezmusic.com/index.php?option=com_blog&view=comments&pid=173461&Itemid=0

     

Log in to post a comment.