Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 05:25:15 +0300
From:      Mihai =?UTF-8?B?RG9uyJt1?= <mihai.dontu@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: bash Shell Scripting Question
Message-ID:  <20120920052515.4ab8a317@mdontu-l.dsd.ro>
In-Reply-To: <201209200203.q8K23Bv5034624@x.it.okstate.edu>
References:  <201209200203.q8K23Bv5034624@x.it.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 19 Sep 2012 21:03:11 -0500 Martin McCormick wrote:
> #!/usr/local/bin/bash=20
> ls -LF |grep \/ >/tmp/files
> while read dirname; do
> cd $dirname
> #Do whatever commands to be repeated in each directory.
> done < /tmp/files
>=20

How about:

   ls -LF | grep \/ | while read dirname; do
   cd $dirname
   # do stuff
   done

or:

   find . -maxdepth 1 -type d | while read dirname; do
   cd $dirname
   # do stuff
   done

or even:

   find . -maxdepth 1 -type d ! -name ".*" | while read dirname; do
   cd $dirname
   # do stuff
   done

--=20
Mihai Don=C8=9Bu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120920052515.4ab8a317>