Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm following this tutorial and it says to create folders like this:

mkdir -p /home/demo/public_html/domain2.com/{public,private,log,backup}

when I do this, I get folder names with } and , at the end of their names.

Does that mkdir not work on ubuntu or?

I thought it would create the folders inside the curly braces...

share|improve this question
    
Just tested in bash on a vanilla 10.04 64-bit install... works fine for me. –  cheeseprocedure Nov 26 '10 at 21:16
add comment

3 Answers

up vote 4 down vote accepted

That inline expansion syntax is specific to the Bourne shell and its descendants I think (sh, bash, ksh, zsh). It seems likely that your tutorial is expecting you to be running bash and you are running something else (csh, tcsh?)

share|improve this answer
    
sh doesn't do that, but Bash, ksh and zsh do. –  Dennis Williamson Nov 27 '10 at 1:23
    
Not certain, but doesn't Ubuntu use dash in some places now? –  Zoredache Nov 27 '10 at 5:01
add comment

Something is not working in your shell. Are you using bash ? Your command should create all the folders in the brackets at once and without brackets. try to make them one by one

mkdir /home/demo/public_html/domain2.com/public

mkdir /home/demo/public_html/domain2.com/private

mkdir /home/demo/public_html/domain2.com/log

mkdir /home/demo/public_html/domain2.com/backup

share|improve this answer
add comment

This worked for me on CentOS 5.5 with bash 3.2.25 and GNU mkdir 5.97.

The commenters are correct in that bash will pass the arguments to mkdir separately (assuming you're running a standard bash shell and you specify the arguments correctly.)

Nonetheless, I still think it's worth mentioning that if your system has commands which aren't working as expected, then it can be worthwhile to check that you're running the "normal" version of the program for the command in question. I have seen systems set up with non-standard variants of some commands because the SA didn't like the standard version or didn't want their users to have access to some of the power of the standard version.

share|improve this answer
1  
"mkdir" doesn't implement this functionality, it's the shell that does (or in this case doesn't :-). –  Sean Reifschneider Nov 26 '10 at 21:49
    
@Sean Reifschneider: If, as I was suggesting, a non-standard mkdir is running (and I've seen such where overly protective and/or paranoid sys admins wanted to be sure their users didn't hurt themselves or the system) then you can't be sure how mkdir will process what the shell gives it. –  GreenMatt Nov 26 '10 at 22:41
    
If the shell is Bash, ksh or zsh, what it gives mkdir in this case has no braces or commas - mkdir never sees them at all. –  Dennis Williamson Nov 27 '10 at 1:21
    
@Sean Reifschneider & @Dennis Williamson: You're right, of course, and I've edited the answer. However, I still think it's worthwhile to mention that the command could be non-standard. –  GreenMatt Nov 29 '10 at 15:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.