![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error executing shell command from a perl script | voorkey | Shell Programming and Scripting | 5 | 03-30-2009 07:48 AM |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| PZ help :configure: error: cannot find output from flex; giving up | bullet350 | SUN Solaris | 0 | 11-29-2007 05:24 AM |
| Backup is giving me input/output error | JPigford | UNIX for Dummies Questions & Answers | 8 | 01-28-2005 07:00 PM |
| /dev/rStp0 giving error | workingstiff | UNIX for Dummies Questions & Answers | 1 | 10-29-2002 06:25 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
You are trying to make life much harder than it needs to be.
Especially your $fdquote thing. The shell interprets many characters and I can't tell if you are trying to assist or confuse the hell out of the interpretor. |
|
||||
|
You dont need fquote and fdquote, just use quotes where you need them. It will honestly make it much clearer. The syntax to shell scripts hasn't changed much in 25 years, these things don't need to be variables.
also you don't need the sleep. Once you've simplified it, then repost it and we can have another look. ![]() |
|
||||
|
Excellent,
![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|