The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-13-2007
gammit gammit is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 8
mv command is giving error in shell script

Hi,

In my shell script when I am using mv command using shell variables it is giving me error of syntax. Following is the shell script:

file_edifice="*.txt"
fquote="'"
fdquote=\"

for file in $file_edifice
do
file_name=$fquote$file$fquote
tofile_name=`date "+%d%m%y:%H%M%S:edifice.data"`
echo $filename
echo $tofile_name
mv $file_name $tofile_name
sleep 2
done


errors :

'ACADEMY SPORTS_ACADEMY SPORTS_20071208.txt'
131207:011618:edifice.data
Usage: mv [-f] [-i] [-e warn|force|ignore] f1 f2
mv [-f] [-i] [-e warn|force|ignore] f1 ... fn d1
mv [-f] [-i] [-e warn|force|ignore] d1 d2

'BOSCOVS_BOSCOVS_20071208.txt'
131207:011620:edifice.data

mv: 'BOSCOVS_BOSCOVS_20071208.txt': cannot access: No such file or directory

'DICKS SPORTING GOODS_DICKS SPORTING GOODS_20071208.txt'
131207:011622:edifice.data
Usage: mv [-f] [-i] [-e warn|force|ignore] f1 f2
mv [-f] [-i] [-e warn|force|ignore] f1 ... fn d1
mv [-f] [-i] [-e warn|force|ignore] d1 d2

'SPORT CHALET_SPORT CHALET_20071208.txt'
131207:011624:edifice.data
Usage: mv [-f] [-i] [-e warn|force|ignore] f1 f2
mv [-f] [-i] [-e warn|force|ignore] f1 ... fn d1
mv [-f] [-i] [-e warn|force|ignore] d1 d2

'THE SPORTS AUTHORITY, INC._THE SPORTS AUTHORITY, INC._20071208.txt'
131207:011626:edifice.data
Usage: mv [-f] [-i] [-e warn|force|ignore] f1 f2
mv [-f] [-i] [-e warn|force|ignore] f1 ... fn d1
mv [-f] [-i] [-e warn|force|ignore] d1 d2

Please suggest.

Thanks,
gammit