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 creating a small shell script, and i want to know if is there a builtin command to create a new folder without using the mkdir command. I googled it but i wasn't able to find a way to do that.

I dont have any specific motivation or restriction to do that, is more a curiosity about the builtin commands on bash.

I imagine is somenthing like the touch file => > file

Regars

share|improve this question

2 Answers 2

up vote 2 down vote accepted

We generally don't play games here and artificially restrict what can and can't be used just for the fun of it. The builtin commands are

bash, :, ., [, alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, com- popt, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait

You can find out more about them using man builtins.

share|improve this answer
    
It is useful to know alternatives for non-builtins such as mkdir or ls when working on a broken system. By the way, echo * is the substitute for ls. –  Dennis Williamson Jul 3 '13 at 17:57

This is not a 'builtins' solution (like touch is not a builtin), but it is a bash friendly solution.

Since this is a script, you imply planning. With this in mind, you create a directory, which you plan to use when the need arises within your script. When you need a new, empty directory, you will use the 'cp -r' command.

You would create a directory: /tmp/seed

In your script you need a directory called blue2013.

cp -r /tmp/seed ./blue123
share|improve this answer
    
If you want to make sure the directory stays empty so the recursive copy only copies the directory, chmod -w /tmp/seed Also, you may want to put your seed directory somewhere else so it doesn't get automatically deleted. –  Dennis Williamson Jul 3 '13 at 18:35

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.