Hour 9

1: What combination of wildcards should you use to list all the files in the current directory that end in the form hwXYZ.ABC?

Here X and Y can be any number; Z is a number between 2 and 6; and A, B, and C are characters.

A1: The following command will accomplish this task:
$ ls *hw[0-9][0-9][2-6].???
2: What action is performed by the following line, if the variable MYPATH is unset:
: ${MYPATH:=/usr/bin:/usr/sbin:/usr/ucb}
A2: If MYPATH is unset, it is set to the given value, which is then substituted.
3: What is the difference between the actions performed by the command given in the previous problem and the action performed by the following command:
: ${MYPATH:-/usr/bin:/usr/sbin:/usr/ucb}
A3: If MYPATH is unset, the given value is substituted ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.