Move command problem | Unix Linux Forums | Shell Programming and Scripting

  Unix/Linux Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Move command problem

Shell Programming and Scripting

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 02-15-2008
srivishnu_253 srivishnu_253 is offline
Registered User
Join Date: Aug 2007
Last Activity: 3 July 2008, 9:25 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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
Old Unix and Linux 02-15-2008
fimblo fimblo is offline
Registered User
Join Date: Feb 2008
Last Activity: 7 May 2009, 12:03 PM EDT
Location: stockholm sweden
Posts: 31
Thanks: 0
Thanked 1 Time in 1 Post
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:

saved_ifs=$IFS; IFS='
for $file in $(find $search_here -type f -name "$LOGFILE" ) ; do
  mkdir -p $savedir
  mv -f "$file" $savedir

If you dont need to worry about filenames with whitespaces in them, you can remove the first, second and last line.

The Following User Says Thank You to fimblo For This Useful Post:
praveensalagar (05-01-2014)
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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

All times are GMT -4. The time now is 06:17 AM.