Ranges in shell scripts

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 filez

The 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 file4

Additional information can be found in the man page of bash, under "Brace Expansion".

Comments

iMessage is one of the best

iMessage is one of the best instant messaging apps for your smartphone, but the main problem with this app is that you can only use this app on your iOS device.
iMessage For Android

Thanks for the idea. I've

Thanks for the idea. I've used the tips and it gives the result I wanted. - Bath Planet

Liked the tips. Added article

Liked the tips. Added article to my library:
http://fosslib.tsakf.net/record/319

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 [email protected]