Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

bad interpreter – no such file or directory

leave a comment »

I hit this error recently “bad interpreter – no such file or directory” when I trying to run/execute a shell script in linux box. The shell script is quite simple, just to initialize a java class.

This “bad interpreter – no such file or directory” is cause by the line-feed / carriage-return issue among windows-linux OS. The shell script is initially written in windows before I ftp it into linux box and run.

To solve it, is very simple — dos2unix.
$> dos2unix my-script.sh

The dos2unix is DOS/MAC to UNIX text file format converter (according to linux manual). It helps to solve the CR/LF conflicts between windows and *nix.

Besides, do remember to do another command to make an .sh file executable in linux — chmod.

$> chmod +x my-script.sh

Advertisements

Written by Alfred

May 9, 2008 at 11:22

Posted in linux

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: