Bash script to move files
Solution 1:
That's because you used #!bin/bash/
and this is wrong. The right way is:
#!/bin/bash
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:
#!/bin/bash
mv /path/to/source /path/to/destination
That is how your script should look like.