Skip to Content
Learn Linux Shell Scripting - Fundamentals of Bash 4.4
book

Learn Linux Shell Scripting - Fundamentals of Bash 4.4

by Sebastiaan Tammer
December 2018
Beginner
452 pages
12h 17m
English
Packt Publishing
Content preview from Learn Linux Shell Scripting - Fundamentals of Bash 4.4

Similarities with regular expressions

As stated, glob commands achieve a similar effect to regular expressions. There are some differences though. For example, the * character in regular expressions stood for zero or more occurrences of the preceding character. For globbing, it is a wildcard for any and all characters, more similar to the .* notation of regular expressions.

As with regular expressions, a glob pattern can consist of normal characters, combined with special characters. Take a look at an example where ls is used with different arguments/globbing patterns:

reader@ubuntu:~/scripts/chapter_09$ ls -ltotal 68-rw-rw-r-- 1 reader reader  682 Oct  2 18:31 empty-file.sh-rw-rw-r-- 1 reader reader 1183 Oct  1 19:06 file-create.sh-rw-rw-r-- ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bash Scripting Fundamentals

Bash Scripting Fundamentals

Sander van Vugt

Publisher Resources

ISBN: 9781788995597Supplemental Content