mirror of
https://github.com/Hizenberg469/Makefile-tutorial.git
synced 2026-04-19 22:02:24 +03:00
update
This commit is contained in:
@@ -297,4 +297,42 @@
|
|||||||
|
|
||||||
[[ $STR1 =~ $regex ]]
|
[[ $STR1 =~ $regex ]]
|
||||||
|
|
||||||
|
|
||||||
|
-> Wildcards (globbing patterns)
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
| Symbol | Description | Example | Example matches |
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
| ? | Single | hel? | help, hell, |
|
||||||
|
| | character | | hel1.... |
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
| * | Any number of | ca* | car,ca,carpet, |
|
||||||
|
| | characters | | carpenter,car112.. |
|
||||||
|
| | (including zero)| | |
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
| [] | Single character| file[0-2] | file0,file1,file2 |
|
||||||
|
| | from range | [hd]ello | hello or dello |
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
| {} | Comma seperated | {*.txt, | hello.txt,doc.txt, |
|
||||||
|
| | terms | *.pdf} | source.pdf, book.pdf|
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
| [!] | Any character | file[!1] | file2,file3.... |
|
||||||
|
| | listed in | | |
|
||||||
|
| | brackets | | |
|
||||||
|
|-----------------------------------------------------------------------|
|
||||||
|
|
||||||
|
* some useful character classes: (use it within [])
|
||||||
|
|
||||||
|
|-------------------------------------------|
|
||||||
|
| [:upper:] | Uppercase character |
|
||||||
|
| [:lower:] | Lowercase character |
|
||||||
|
| [:alpha:] | Alphabetic character |
|
||||||
|
| [:digit:] | Number character |
|
||||||
|
| [:alnum:] | Alphanumric character |
|
||||||
|
| | (alpha + digit) |
|
||||||
|
| [:space:] | whitespace character |
|
||||||
|
| | (space, tab, newline) |
|
||||||
|
|-------------------------------------------|
|
||||||
|
|
||||||
|
* [[ $STRING == pattern_with_wildcards ]]
|
||||||
|
* [[ $STRING == file[0-9].txt ]]
|
||||||
|
* [[ $STRING == rich* ]]
|
||||||
Reference in New Issue
Block a user