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



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
Need help on move (mv) command jambesh Shell Programming and Scripting 2 04-26-2008 11:23 AM
move command thepurple SUN Solaris 3 10-06-2007 07:26 AM
How to test whether a move command has been well executed Lutchumaya Shell Programming and Scripting 6 01-25-2007 02:56 AM
Move command in the shell isnt executing... thumsup9 Shell Programming and Scripting 2 02-01-2005 09:50 PM
Help on MOVE command michelr UNIX for Dummies Questions & Answers 2 03-13-2001 11:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-15-2008
srivishnu_253 srivishnu_253 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 2
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??......
  #2 (permalink)  
Old 02-15-2008
fimblo fimblo is offline
Registered User
  
 

Join Date: Feb 2008
Location: stockholm sweden
Posts: 31
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0