Timeline for In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 24, 2022 at 12:31 | comment | added | Brian Wiley | if you have files FOO_1.out and FOO_1.arc and you only want to match arc files then this doesn't work and files=( FOO*.arc ) will return 1 even you only have a FOO_1.out which is not desired | |
| S Jan 23, 2015 at 16:44 | history | suggested | CommunityBot | CC BY-SA 3.0 | for ends with done - Shadow_I |
| Jan 23, 2015 at 16:19 | review | Suggested edits | |||
| S Jan 23, 2015 at 16:44 | |||||
| Nov 12, 2013 at 10:14 | vote | accept | Jonik | ||
| Nov 12, 2013 at 10:12 | history | edited | Chris Down | CC BY-SA 3.0 | deleted 7 characters in body |
| Nov 12, 2013 at 10:10 | comment | added | Chris Down | @Jonik Sure, just call shopt -u nullglob. It could cause problems if your script does some things that rely on POSIX null globbing behaviour. help shopt may also give you some useful information about it. | |
| Nov 12, 2013 at 10:07 | comment | added | Jonik | Thanks, this works. I've never seen shopt -s nullglob before but it makes the difference here. I just hope it doesn't trigger any problems in the remainder of the script (at least it does weird things to normal Bash shell). Can you turn that mode off later in the script? | |
| Nov 12, 2013 at 10:06 | history | edited | Chris Down | CC BY-SA 3.0 | added 297 characters in body |
| Nov 12, 2013 at 10:01 | history | edited | Chris Down | CC BY-SA 3.0 | added 297 characters in body |
| Nov 12, 2013 at 9:53 | history | answered | Chris Down | CC BY-SA 3.0 |