You can use backticks to store the result of a command (in my example, it's `uname`) on a variable, then `echo` it onscreen, and eventually use it as argument to `mkdir`: FOO=`uname -n` echo $FOO mkdir $FOO