I have a file containing a list of directories. For instance
/foo/bar/dir1
/foo/bar/dir2
/foo/bar/dir3
I want to create all these directories. Here's what I did:
for dir in $(cat myfile); do mkdir $dir; done
What would be the correct way of doing this while avoiding the "useless use of cat"?
Ideally, answers would focus on Ksh88, but I'm also interested in other shells
$ mkdir /foo/bar/dir{1,2,3}
or$ mkdir /foo/bar/{dir1,dir2,dir3}
– Nikhil Mulley Dec 19 '11 at 19:39ksh
). In any case I found my answer; I was not familiar withread
. The man page will do the rest. – rahmu Dec 20 '11 at 13:54