You must log in or register to comment.
I think an alias could do that. Another good one is cd then ls.
An alias only runs a single command
Nice short helper!
Why would you
eval cd "\"\$$#\""
??? So you’re passing all arguments tomkdir
potentially making several folders (mkcd test1/foo1 test2/foo2
), then moving into the last provided argument ($# is 1 when there is one argument and $1 is the argument) via some exec magic. To be fair it does look safe (but execs always look safe :D) but why not move into the first provided argument instead (&& cp "$1"
) and avoid that dance entirely?I have a little function for that
mkdirpushd () { mkdir -p ${1} pushd ${1} }