![]() In this example, I am matching (rather than excluding) certain patterns since there are a more limited number of pattern matches that I want than that I don't want. ![]() I use a "do while" loop to read the output of the find command. Type cp *, hit Ctrl X * and just see what happens. □ cp (string match -v '*.excluded.names' - srcdir/*) destdir The fish shell has a much prettier answer to this: Once again, for full details refer to manpage. So x~y matches pattern x, but excludes pattern y. You can do setopt KSH_GLOB and use bash-like patterns. The pattern can be arbitrarily complex, starting from enumeration of individual paths (as Vanwaril shows in another answer): !(filename1|path2|etc3), to regex-like things with stars and character classes. So you just put a pattern inside !(), and it negates the match. ![]() Instead, such things can be done as part of globbing, i.e. ), an immense duplication of effort would occur. Well, if exclusion of certain filename patterns had to be performed by every unix-ish file utility (like cp, mv, rm, tar, rsync, scp.
0 Comments
Leave a Reply. |