4 ms·
I vote for creating a « mkcd » alias !!
by xiekomb 6y ago
I vote for creating a « mkcd » alias !!
- thunderbong 6y ago# create a directory in the current directory and cd to it function mkcd() { mkdir -p "$@" && eval cd "\"\$$#\""; }
- teddyh 6y agoWhy the eval? This works fine for me: mkcd(){ mkdir --parents -- "$@" && cd -- "$@"; }
- danwills 6y agoHere's my answer to that, an 'nd' (newdir?) alias that calls this python script: https://github.com/danwills/shell-scripts/blob/bb989985d270c394167ae19831dea06b3926da8b/nd.py https://github.com/danwills/shell-scripts/blob/bb989985d270c... This makes all directories with names provided by args, including spaces and multiple levels (slashes) at once. It then enters the resulting directory as well (when aliased including 'cd' as advised in the comment).