Q. How to create multiple directories recursively with single command?
Ans:
Quote:
user@localhost$ mkdir -p dir1/{dir2,dir3,dir4}/
|
Will create dir2,dir3,dir4 under dir1 i,e at second level down there will be three directories.
case2:
Quote:
user@localhost$ mkdir -p dir1/{dir2,dir3,dir4}/{dir5,dir6}
|
This will create one dir1 at level1,
then three directories dir2,dir3,dir4 at level 2,
then two directories dir5,dir6 under each of level 2 directory i.e dir2, dir3,dir4
dir1/
dir2/ dir3/ dir4/
dir5/ dir6/ dir5/ dir6/ dir5/ dir6/
Do you have any idea regarding bash shell's abilities? If not please go through the bash reference manual.
Q. Creating multile users with single line?
Ans. write a simple for loop. It is one liners.