--On Saturday, July 03, 2004 7:13 PM +1000 Darren Reed <[EMAIL PROTECTED]> wrote:

I think using the pattern 'hostname.*[!:][0-9]' is better to only
match real interface names.

Ummm... no

carson:gandalf 0 $ touch hostname.foo0:100 hostname.foo0

carson:gandalf 0 $ ls hostname.*[!:][0-9]
hostname.foo0
hostname.foo0:100

You can't do what you want using only normal globs. You can do it with extglobs (shopt -s extglob in bash):

carson:gandalf 0 $ ls hostname.+([!:])
hostname.foo0

Or you can do it in (POSIX) shell:

carson:gandalf 0 $ OIFS="${IFS}" IFS="${IFS}:"; ls hostname.* | while read intf alias; do if [ -z "${alias}" ]; then echo $intf; fi; done; IFS="${OIFS}"
hostname.foo0


--
Carson




Reply via email to