How can I make the list of letters from A to Z and iterate through them in the shell?
Hope you have Ruby installed. ;)See this, plain command-line from the shell:
using Ruby to iterate from A to Z and ask to print the letters:
$ ruby -e ' "a".upto("z") {|letter| print letter}; print "\n"'
iterate from A to Z and substitute the value obtained during the current iteration into a string, then print the string:
$ ruby -e ' "a".upto("z") {|letter| puts "mkdir #{letter}"}'
mkdir amkdir bmkdir cmkdir d...mkdir z
use the output of the iteration from A to C as an argument to
mkdir
, in order to create 3 directories:$ mkdir $(ruby -e ' "a".upto("c") {|letter| puts "#{letter}"}')
do a listing to see the results:
$ ls -aldrwxr-xr-x 2 iuliu users 4096 2009-10-07 00:09 adrwxr-xr-x 2 iuliu users 4096 2009-10-07 00:09 bdrwxr-xr-x 2 iuliu users 4096 2009-10-07 00:09 c
Hope this helps a bit! ;)
regards,Iuliu