Skip to Main Content
Linux Shell Scripting Essentials
book

Linux Shell Scripting Essentials

by Sinny Kumari
November 2015
Beginner content levelBeginner
282 pages
5h 5m
English
Packt Publishing
Content preview from Linux Shell Scripting Essentials

Shell expansions

While working with shell, we perform a lot of similar and repetitive tasks. For example, in the current directory, there are 100 files but we are interested only in shell script whose file extension is .sh. We can execute following command to view only shell script files in current directory:

$ ls *.sh

This will show all the files ending with .sh. An interesting take away from here is the * wildcard. It means a match list of files whose name can be anything and that ends with .sh.

Shell expands all wildcard patterns. A list of the latest wildcard patterns are as follows:

  • ~ (Tilde)
  • * (Asterisk)
  • ? (Question mark)
  • [ ] (Square brackets)
  • { } (Curly brackets)

To explain shell expansion for different wildcards, we will create a test folder ...

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

Learning Linux Shell Scripting

Learning Linux Shell Scripting

Ganesh Sanjiv Naik

Publisher Resources

ISBN: 9781785284441Supplemental Content