diff options
Diffstat (limited to 'sh')
-rw-r--r-- | sh/shrc.d/md.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sh/shrc.d/md.sh b/sh/shrc.d/md.sh index cf44abb3..1f8a8aaf 100644 --- a/sh/shrc.d/md.sh +++ b/sh/shrc.d/md.sh @@ -10,6 +10,15 @@ md() { # If first arg unset or empty, assume the user means the current dir [ -n "$1" ] || set -- "$PWD" + # If specified path is . or .., quietly expand it + case $1 in + .) set -- "${PWD%/}" ;; + ..) + set -- "${PWD%/}" + set -- "${1%/*}" + ;; + esac + # If specified path not a directory, refuse to mark it if ! [ -d "$1" ] ; then printf >&2 'md(): Not a directory\n' |