.config/fish/functions/mkcd.fish
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function mkcd --description 'Make directory and cd into it. Note: STILL has one edge case (if argument contains '..' AND goes through symlink)'
if test (count $argv) -ne 1
return 1
end
#case "$1" in /*) :;; *) set -- "./$1";; esac # for weird directories "-xx/"
switch "$argv[1]"
case /*
set -f dest "$argv[1]"
case '*'
set -f dest "./$argv[1]"
end
mkdir -p "$dest" && cd "$dest"
end
|