OT: shell scripting problem
John Summerfied
debian at herakles.homelinux.org
Wed May 18 00:24:06 UTC 2005
linux.whiz at gmail.com wrote:
> My brain is fried. I know there is a simple answer to this but I'm
> drawing a blank. I want to run a script against the contents of a
> text file. The text file is just my users' first name, middle initial
> and last name like this:
>
> John A Smith
> Mary P James
> Sally R Jones
> Fred Q Davis
>
> What I want to do is for each user in this file, run a script. I
> tried to do this:
>
> for i in `cat textfile`; do
> myscript.sh $i
> done
>
> I expect this to run like this:
>
> myscript.sh John A Smith
> myscript.sh Mary P James
> myscript.sh Sally R Jones
> myscript.sh Fred Q Davis
>
> Instead it runs like this:
<snip>
> How do I get this script to run correctly?
cat textfile | while read aline
do myscript.sh $aline
done
--
Cheers
John
-- spambait
1aaaaaaa at computerdatasafe.com.au Z1aaaaaaa at computerdatasafe.com.au
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/
More information about the fedora-list
mailing list