Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a beginner and I need help.

I'm trying to make a script to move some files from one directory in another directory. Before to create the script I tested the command and it was working:

mv /path/to/source  /path/to/destination

After I've made the script with nano:

echo "mv /path/to/source  /path/to/destination"

I've made the script executable with: chmod +x file and then executed as ./file but the following error appears:

bash: ./ /bin/bash/: bad interpreter: Not a directory

I tried and with sudo ./file and bash file but it’s not working.

I'm using Ubuntu installed with VirtualBox.

share|improve this question
You should take a look at the Advanced Bash-Scripting Guide. – LiveWireBT Oct 22 '13 at 15:22

That's because you used #!bin/bash/ and this is wrong. The right way is:


This is called a shebang and it tells the shell what program to interpret the script with, when executed.

Another thing: the absolute path for bash interpreter in Ubuntu is /bin/bash, not bin/bash/ or something else. You can check this using which bash command.

And another thing, but probably you know this: the following line:

echo "mv /path/to/source /path/to/destination"

will only display a text message with mv /path/to/source /path/to/destination. To really move files use the following script:

mv /path/to/source /path/to/destination

That is how your script should look like.

share|improve this answer
fyi, Ubuntu has historically packaged a crappy version of the incredibly useful which command. It's worth the manual install to get the gnu which. – djeikyb Oct 23 '13 at 2:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.