Linux/UNIX command help

Status
Not open for further replies.

neo214

Baseband Member
Messages
94
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?
 
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}
 
So a semicolin will nest commands (or sequence them so they will come out after another?
 
horndude said:
mkdir dir1 dir2 dir3; touch dir1/file1 dir2/file2 dir3/file3

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 :))))
 
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!
 
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
 
Status
Not open for further replies.
Back
Top Bottom