Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Feb 2000 15:54:39 -0500
From:      "James A. Mutter" <jmutter@ds.net>
To:        darryl@osborne-ind.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: OFF TOPIC - Shell Script Question
Message-ID:  <38A0828F.6E5E703C@ds.net>
References:  <001101bf7273$e44dc250$070101c0@ruraltel.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Darryl Hoar wrote:
> 
> Greetings,
> I have a directory with a ton of files in it.  I need to move some of
> them to another
> directory.  Here's what I'm thinking:
> 
> ls -tl | grep '1999' | awk '{print "mv " $9 " /home/darryl/test"}'
> 
> but it does not 'execute' the mv command.  How do I get this cooking ?
> 

And it's not going to execute the 'mv' command - no matter how hard you
try.  :)
Instead, try something like this:

for i in `ls -t`; do
  mv $i /home/darryl/test
fi

There are other ways to do this too - but I thought it might be useful
to see how a simple loop works in 'sh'


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38A0828F.6E5E703C>