|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Move command problem
In my shell script I am searching a log file, creating a directory and have to move the searched logfile into the directory.This is the way I wrote:
ZIP_LOG_FILE=`find . -name "${LOG_FILE}" -print0| xargs -0 tar zcf FILE` mkdir temp_log mv -f ${ZIP_LOG_FILE} temp .... this is a piece of the script....and I get this error: mv: missing destination file operand after `templog' Try `mv --help' for more information. What could be wrong??...... |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
to answer your question about mv- your first param which is a variable is probably empty, resulting in a mv expression with only one parameter. Thats why its complaining. I'd write it in another way, try this: Code:
saved_ifs=$IFS; IFS=' ' for $file in $(find $search_here -type f -name "$LOGFILE" ) ; do mkdir -p $savedir mv -f "$file" $savedir done IFS=$saved_ifs If you dont need to worry about filenames with whitespaces in them, you can remove the first, second and last line. cheers |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with move command | eskay | Shell Programming and Scripting | 8 | 04-17-2012 07:38 AM |
| Copy or Move problem | sraj142 | Shell Programming and Scripting | 9 | 09-12-2011 04:10 AM |
| Move Command and exit status problem | visingha | Shell Programming and Scripting | 10 | 09-13-2008 08:08 PM |
| Move Command and exit status problem | visingha | UNIX for Dummies Questions & Answers | 1 | 09-12-2008 02:14 AM |
| move command | thepurple | Solaris | 3 | 10-06-2007 07:26 AM |
|
|