[CentOS] [OT] Simple Shell Script (while loop)

John R. Dennison jrd at gerdesas.com
Wed Jun 3 07:59:38 UTC 2009


On Wed, Jun 03, 2009 at 08:44:29AM +0100, James Bensley wrote:

	There are many ways to do this; building on your code
	snippet it would be:

#!/bin/bash
find ./ -maxdepth 1 -type d | while read FOLDER
do
	if [ "$FOLDER" = "./not_this_folder_oh_no!" ]; then
		continue
	fi
	<otherwise do some magic here>
done

"continue" is treated as a reloop operator; and you should quote strings.





							John

-- 
"I'm sorry but our engineers do not have phones."
As stated by a Network Solutions Customer Service representative when asked to
be put through to an engineer.

"My other computer is your windows box."
                                     Ralf Hildebrandt
<sxem> trying to play sturgeon while it's under attack is apparently not fun.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20090603/822109f8/attachment.sig>


More information about the CentOS mailing list