[clue-tech] Bash script question
Jim Ockers
ockers at ockers.net
Wed Sep 14 17:59:41 MDT 2005
Hi Tom,
> > I have a shell script that does something like this:
> >
> > for file in `ls`
> > do
> >
> > However, I would rather be able to pipe a list of items into the script,
> > instead of relying always on ls:
> >
> > ls | myscript
> >
> > Is this possible?
> >
>
>
> Sure:
>
>
> #!/bin/bash
> # myscript
> while read file ; do
> echo got $file
> done
>
>
> use as:
>
> ls | myscript
Will this work if the files have spaces in the names? I didn't try
it of course, just wondering.
Thanks,
Jim
--
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: please see http://www.ockers.net/
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech
More information about the clue-tech
mailing list