Notepad ++ Unix Shell Scripts and the ‘No such file or directory’ error on Ubuntu Server


ubuntu-server-logo

I first encountered this issue a long time ago and forgot to document it – so now I had to resolve it again.

I’m running Notepad ++ on Windows and using WinSCP to transfer bash scripts to Ubuntu Server. My script is saved as an Unix script file (*.sh, *.bsh) in Notepad++ and WinSCP is set to transfer files in binary mode.

When I run the script on Ubuntu Server I get the following error:

: No such file or directory

I could see the problem in Notepad++ and in nano on Ubuntu Server when I wanted to save the file – the file was formatted for Dos\Windows.

dos-windows
Notepad ++ document format set to Dos\Windows
dos-format
Nano saving .sh as Dos Format

The fix is to change the formatting to UNIX. In Notepad ++ click Edit, EOL Conversion and UNIX and save the file.

Easy when you remember how!

Advertisements

5 thoughts on “Notepad ++ Unix Shell Scripts and the ‘No such file or directory’ error on Ubuntu Server

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