zsh for loop exclusion

Posted by ABach on Stack Overflow See other posts from Stack Overflow or by ABach
Published on 2010-05-23T04:10:10Z Indexed on 2010/05/23 4:10 UTC
Read the original article Hit count: 256

Filed under:
|
|

This is somewhat of a simple question, but for the life of me, I cannot figure out how to exclude something from a zsh for loop. For instance, let's say we have this:

for $package in /home/user/settings/*
do
  # do stuff
done

Let's say that in /home/user/settings/, there is a particular directory ("os") that I want to ignore. Logically, I tried the following variations:

for $package in /home/user/settings/^os (works w/ "ls", but not with a foor loop)
for $package in /home/user/settings/*^os
for $package in /home/user/settings/^os*

...but none of those seem to work. Could someone steer my syntax in the right direction?

© Stack Overflow or respective owner

Related posts about for-loop

Related posts about zsh