[sf-lug] path name expansion

Alex Kleider akleider at sonic.net
Thu Aug 18 21:11:11 PDT 2016


I've been reading The Linux Command Line
Third Internet Edition
William Shotts

and while playing around with and modifying examples have discovered the 
following:

alex at X301n3:~/Test$ rm -r *
alex at X301n3:~/Test$ mkdir Dir{A..C}
alex at X301n3:~/Test$ ls
DirA  DirB  DirC
alex at X301n3:~/Test$ touch Dir*/file{1..3}
touch: cannot touch ‘Dir*/file1’: No such file or directory
touch: cannot touch ‘Dir*/file2’: No such file or directory
touch: cannot touch ‘Dir*/file3’: No such file or directory
alex at X301n3:~/Test$ ls Dir*
DirA:

DirB:

DirC:
alex at X301n3:~/Test$ ls -d Dir*
DirA  DirB  DirC

 From what I read, the touch Dir*/file{1..3] command should have created 
three empty files in each of the three directories.

Where have I misunderstood?

Alex

ps I'm running Ubuntu 14.04LTS (still) and the shell, I believe, is 
dash, not bash.
pps Sanity check:
alex at X301n3:~/Test$ touch file{1..3}
alex at X301n3:~/Test$ ls
DirA  DirB  DirC  file1  file2  file3




More information about the sf-lug mailing list