How to un-select files in shell wildcard patterns

Matthew Seaman matthew at FreeBSD.org
Sat Jun 22 11:45:14 UTC 2019


On 22/06/2019 00:40, Polytropon wrote:
> So, is it correct that there is no shell builtin mechanism for
> this kind of "negative selection"?

You can use a case statement like so:

for f in $filelist ; do
    case f in
       "*a*")   # Ignore files with 'a' in the name
           ;;
       "*")
           do something
           ;;
    esac
done

	Cheers,

	Matthew


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20190622/05a2e18b/attachment.sig>


More information about the freebsd-questions mailing list