-1

I'm learning bash and I tried to make a simple script that changes the directory and executes a command, like this:

#!/bin/bash
cd adf-elite-connector
<execute a command>

But I was getting the following error:

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

If I removed the bin/bash header and have the following script:

cd adf-elite-connector
<execute a command>

I would get an error with a truncated directory name:

: No such file or directoryite-connector

1

1 Answer 1

0

I was creating the script in windows and I was uploading the file to linux. End Of Line characters (EOL) differ between windows and linux. So all I had to do is convert EOL characters from windows to linux.

This can be done with Notepad++, going to Edit > EOL Conversion > Unix (LF)

After I uploaded the converted file, it would change the directory and execute the command without a problem.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.