SysAdmin Blog, TechTips and Reviews

System Administrators’ Blog

Used Another ‘For… DO’ Loop

June 6th, 2008 by elizar

The last post, was used to chmod a list of home directory.

I used another application for that ‘for..do’ loop again… it’s climbing my favorite script command list.. :) second only to ‘while…do’.. :)

for X in `ls -last | grep 2006 | awk ‘{print $9}’`
do
rm -rf $x
done

bye bye 2006 directories!

Filed under Commands, Scripting having

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.