Timeline for Exclude one pattern from glob match
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 23, 2024 at 13:32 | comment | added | Hi-Angel |
Worth noting that there are bugs in how this variable is processed. Let's say, we have touch a.deb b.deb c.deb. So, first of all, it's completely ignored when it's inherited. So e.g. this way GLOBIGNORE="/tmp/a.*" bash -c 'ls /tmp/*.deb still prints a.deb even though the bash subcommand sees it just fine. Then, two globs don't work either, so e.g. this command bash -c 'GLOBIGNORE="*a.*"; ls /tmp/*.deb' prints a.deb as well.
|
|
| Jul 26, 2022 at 13:03 | history | edited | mivk | CC BY-SA 4.0 |
Added semi-colon back, because otherwise, expansion is done before.
|
| Aug 7, 2021 at 16:46 | comment | added | Ron Burk | Thank you @consideRatio for the explanation. So that's why the subshell and semicolon were suggested by DBedrenko. The OP simply doesn't work and any version that does work leaves you an environment variable to clean up. | |
| Jul 15, 2021 at 18:56 | comment | added | consideRatio |
Hmmm I ended up needing to add a && between setting the GLOBIGNORE and the command following where it is supposed to be applied. I assume that if you don't, the entire expression is evaluated and all * snippets are expanded - at which point it is too late to set GLOBIGNORE. In other words, for this example: GLOBIGNORE="*.org" && rm -i foo*
|
|
| May 24, 2021 at 20:20 | history | edited | mivk | CC BY-SA 4.0 |
deleted 1 character in body
|
| May 8, 2019 at 18:45 | comment | added | phyatt |
Note if you want to expand the list of ignored, separate with a colon, such as GLOBIGNORE="*foo*:*bar*"
|
|
| Mar 9, 2017 at 11:20 | comment | added | DBedrenko |
@Ruslan That doesn't work. You should do ( GLOBIGNORE="*.org"; rm -i foo* )
|
|
| Nov 28, 2015 at 18:10 | history | answered | mivk | CC BY-SA 3.0 |