Date: Wed, 19 Sep 2012 21:03:11 -0500 From: Martin McCormick <martin@dc.cis.okstate.edu> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: bash Shell Scripting Question Message-ID: <201209200203.q8K23Bv5034624@x.it.okstate.edu>
next in thread | raw e-mail | index | archive | help
I just discovered a knowledge deficiency on my part that I can't seem to resolve. If one writes a loop of the following form: #!/usr/local/bin/bash ls -LF |grep \/ >/tmp/files while read dirname; do cd $dirname #Do whatever commands to be repeated in each directory. done < /tmp/files This works quite well but it is shall we say sloppy because it creates a file that then must be cleaned up and its name needs to be made unique, etc. The standard output of the `ls -LF |grep \/` command needs to look like a file and all should be well. I thought the < redirection would pickup the standard output. Thanks for ideas. Martin McCormick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209200203.q8K23Bv5034624>