[NTLUG:Discuss] Shell script help 2

. Daniel xdesign at hotmail.com
Mon May 15 11:29:02 CDT 2006


>On Fri, May 12, 2006 at 05:49:30PM -0500, . Daniel wrote:
> > bit.  I may end up simply using rsync in the end but I still want to 
learn
> > more shell scripting through this activity.  In studying random 
examples on
> > the web, I have come up with an interesting way of reading input from
> > outside sources such as a file or the execution of a command.
>
>Learning more is always great, but reinventing the wheel, not so much.

Generally, that's true, but I do want to better understand the construction 
of the wheel using shell components, plus, I would also like to be able to 
do some other things like "delete from backup drive two weeks after 
original has been removed from source drive."  I couldn't see where in 
rsync that would be possible, and that's one of the ideas I've been mulling 
around in my head.

><snip>
> > Here's the problem.  As I mentioned, the for loop reads the output of
> > "find" "word by word" and not "line by line."  This presents a problem 
when
> > filenames have spaces or other delimiter characters in them.  Is there
> > another way to read input line-by-line the way I need?  I can create a
> > temporary file containing the output of "find" but I don't see what 
good
> > that does since it's something about the for loop that's making it
> > word-by-word.  Since this will not work, how can I read a file or 
output
> > "line-by-line"?
>
>awk & sed are your friends and mine.
>
>RW





More information about the Discuss mailing list