Skip to content


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

 

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


Very simple thing but sometimes it will bother you a lot.

I tried to run a shell script  “daily_full_expdp_backup.sh” but it was giving me following error

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

Solution was:

Need to execute following script to clean up windows formatting things (spaces) and make it pure linux formated script. after executing following command (with the script) it worked perfectly.see in below screenshot.

$sed -i -e ’s/\r$//’ daily_full_expdp_backup.sh

Explanation:  The ^M is a carriage return character. Linux uses the line feed character to mark the end of a line, whereas Windows uses the two-character sequence CR LF. Your file has Windows line endings, which is confusing Linux. Remove the spurious CR characters using  sed -i -e ’s/\r$//’

Posted in Apache Web Server, Php. Tagged with .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.