[clue-tech] Bash script question

Tom Poindexter tpoindex at nyx.net
Wed Sep 14 16:38:16 MDT 2005


On Wed, Sep 14, 2005 at 05:42:41PM -0400, Angelo Bertolli wrote:
> 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
  

-- 
Tom Poindexter
tpoindex at nyx.net
http://www.nyx.net/~tpoindex/
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list