I have been admiring the people who know how to use ranges in shell scripts. These people are faster and more fluent on the Linux command line than anybody without knowledge of ranges could be.
Here are some ranges or patters that you could use.
A sequence of characters, in this case 1 to 10, printed on one line.
$ echo "file{1..9}"
file1 file2 file3 file4 file5 file6 file7 file8 file9
$ echo file{s..z}
files filet fileu filev filew filex filey filezThe order of the range can be found in the man-page for "ascii".
A pattern that describes either a range, or a separated pattern.
$ echo file{1,2,4}
file1 file2 file4Additional information can be found in the man page of bash, under "Brace Expansion".
| About | Consultancy | Articles | Contact |
|
|
|
|
|
| References | Red Hat Certified Architect | By Robert de Bock | Robert de Bock |
| Curriculum Vitae | By Fred Clausen | +31 6 14 39 58 72 | |
| By Nelson Manning | robert@meinit.nl |
Comments
Liked the tips. Added article
Liked the tips. Added article to my library:
http://fosslib.tsakf.net/record/319