Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
The square brackets [ ] z/OS UNIX System Services User's Guide SA23-2279-00 |
|
Square brackets containing one or more characters stand for any
one of the contained characters. For example:
matches bat, cat, or hat.
lists all files in the working directory
the names of which start with a, b, or c,
followed by any other sequence of zero or more characters. In other
words, it lists all files whose names start with a, b,
or c.You can specify ranges of characters inside the square brackets
by specifying the first character in the sequence, a hyphen (-),
and the last character. For example:
This
matches any character from a through m.Suppose, for example, that you want to copy the contents of the
working directory into two separate directories. You might enter:
to copy all files with names beginning with the letters a through m to the directory dira, and then issue
the second command:
to copy the rest
of the files to the directory dirb. A command
such as:
removes every file with a suffix consisting
of a single lowercase letter.If the first character inside a bracket construct is an exclamation
mark !, the construct matches any character that is not inside the brackets. For example:
lists any file that does not begin
with one of the letters in the range a through m.In the same way:
removes any file with a
name that does not start with a digit. |
Copyright IBM Corporation 1990, 2014
|