N neo214 Baseband Member Messages 94 Oct 29, 2005 #1 What would be the command to create 3 directories and then create files within all of them? I know it would be mkdir, then touch files, but how would you get all of this done in one command?
What would be the command to create 3 directories and then create files within all of them? I know it would be mkdir, then touch files, but how would you get all of this done in one command?
macdude425 Member (again) Messages 4,202 Location Raul's Wild Kingdom...How 'bout that, huh? Oct 29, 2005 #2 IF you can use &&, which puts multiple commands together in one, then you can do mkdir blah && mkdir blah2 && mkdir blah3, etc.
IF you can use &&, which puts multiple commands together in one, then you can do mkdir blah && mkdir blah2 && mkdir blah3, etc.
OP OP N neo214 Baseband Member Messages 94 Oct 29, 2005 #3 Ahh, so that would be nesting the commands, like to say mkdir "THEN" do this "THEN" do this? So far I have something like mkdir os{001,002,800} that would make the three directories, but I have to put four files log_2005oct{28-31} into each one of them. Okay log_2005oct{28-31} does not work it has to be: touch os_2005oct{28,29,30,31}
Ahh, so that would be nesting the commands, like to say mkdir "THEN" do this "THEN" do this? So far I have something like mkdir os{001,002,800} that would make the three directories, but I have to put four files log_2005oct{28-31} into each one of them. Okay log_2005oct{28-31} does not work it has to be: touch os_2005oct{28,29,30,31}
H horndude Fully Optimized Messages 2,539 Oct 29, 2005 #4 mkdir dir1 dir2 dir3; touch dir1/file1 dir2/file2 dir3/file3
OP OP N neo214 Baseband Member Messages 94 Oct 30, 2005 #5 So a semicolin will nest commands (or sequence them so they will come out after another?
OP OP N neo214 Baseband Member Messages 94 Oct 30, 2005 #6 horndude said: mkdir dir1 dir2 dir3; touch dir1/file1 dir2/file2 dir3/file3 Click to expand... Others said it could not be done! you did it, you my friend earn my person of the day award You are also the master of the shell But really thanks man you rule! with a simple slash mark you have brightened my day )))
horndude said: mkdir dir1 dir2 dir3; touch dir1/file1 dir2/file2 dir3/file3 Click to expand... Others said it could not be done! you did it, you my friend earn my person of the day award You are also the master of the shell But really thanks man you rule! with a simple slash mark you have brightened my day )))
OP OP N neo214 Baseband Member Messages 94 Oct 30, 2005 #7 mkdir os{001,002,800}; touch os{001,002,800}/log_2005oct{28,29,30,31}; chmod +rwx os{001,002,800}/log_2005oct{28,29,30,31} was my final answer thanks! it works!
mkdir os{001,002,800}; touch os{001,002,800}/log_2005oct{28,29,30,31}; chmod +rwx os{001,002,800}/log_2005oct{28,29,30,31} was my final answer thanks! it works!
H horndude Fully Optimized Messages 2,539 Oct 30, 2005 #8 semicolons nest commands or chain them together on the commandline the / is what bash shell and linux in general uses for directory separators-----just like in DOS or windows, only they use the backslash--> \ you could have used a loop as well: for i in 28 29 30 31;do mkdir ~blah blah blah~;done
semicolons nest commands or chain them together on the commandline the / is what bash shell and linux in general uses for directory separators-----just like in DOS or windows, only they use the backslash--> \ you could have used a loop as well: for i in 28 29 30 31;do mkdir ~blah blah blah~;done