Using mv in a script
Hello I'm trying to write a bash script but I'm not having too much success.
Here is the code for the script I named tr:
Code:
#!/bin/bash
path=$1
path=${path//' '/'\ '}
echo $path
sudo mv $path ~/.local/share/Trash/files
Here is the command I used to execute the script:
Here is the output:
es\ se
mv: cannot evaluate `es\\': No file or folder of this type
mv: cannot evaluate `se': No file or folder of this type
Please note that if I remove the 3rd line from the code, the output is as follows:
es\ se
mv: cannot evaluate `es': No file or folder of this type
mv: cannot evaluate `se': No file or folder of this type
The first line of the output is exactly right; however when I give this to the mv command it doesn't use it properly. I am sure this file exists in the current directory.
Thank for the help.
Last edited by silentrebel; April 18th, 2009 at 09:10 PM.
L'idée de communauté consiste d'offrande constante sans s'attendre à quoi que ce soit d'elle.
The idea of community consists of constant giving without expectation of return.
Bookmarks