3 ms·
mine's called cdd, and it's a little more complex: cdd () { case "$1" in */..|*/../) cd -- "$1";; # that doesn't make any sense unless the di
by Leftium 3y ago
mine's called cdd, and it's a little more complex:
cdd () {
case "$1" in
*/..|*/../) cd -- "$1";; # that doesn't make any sense unless the directory already exists
/*/../*) (cd "${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd -- "$1";;
/*) mkdir -p "$1" && cd "$1";;
*/../*) (cd "./${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd "./$1";;
../*) (cd .. && mkdir -p "${1#.}") && cd "$1";;
*) mkdir -p "./$1" && cd "./$1";;
esac
}
https://unix.stackexchange.com/a/9124/4791 https://unix.stackexchange.com/a/9124/4791