bash:globs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
bash:globs [2021/02/04 09:37] – [Glob Star - globstar] peter | bash:globs [2021/02/04 09:43] (current) – [Glob Star - globstar] peter | ||
---|---|---|---|
Line 433: | Line 433: | ||
# Caveat: **.c will not work, as it expands to *.c/*.c/… | # Caveat: **.c will not work, as it expands to *.c/*.c/… | ||
</ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | <code bash> | ||
+ | shopt -u globstar | ||
+ | </ | ||
+ | |||
+ | See: **help shopt** for details. | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | Assume you have a folder structure: | ||
+ | |||
+ | < | ||
+ | . | ||
+ | ├── bar | ||
+ | │ | ||
+ | │ | ||
+ | │ | ||
+ | │ | ||
+ | │ | ||
+ | │ | ||
+ | └── fnord.txt | ||
+ | </ | ||
+ | |||
+ | Then **ls** with single star **< | ||
+ | |||
+ | <code bash> | ||
+ | ls *.txt | ||
+ | fnord.txt | ||
+ | </ | ||
+ | |||
+ | The double star operator **< | ||
+ | |||
+ | <code bash> | ||
+ | ls **/*.txt | ||
+ | bar/ | ||
+ | </ | ||
+ | |||
+ | ---- | ||
<WRAP info> | <WRAP info> |
bash/globs.1612431422.txt.gz · Last modified: 2021/02/04 09:37 by peter