diff options
Diffstat (limited to 'sh/shrc.d/pd.sh')
-rw-r--r-- | sh/shrc.d/pd.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sh/shrc.d/pd.sh b/sh/shrc.d/pd.sh index c022b1e8..de4ea23b 100644 --- a/sh/shrc.d/pd.sh +++ b/sh/shrc.d/pd.sh @@ -4,16 +4,16 @@ # argument, this just shifts up a directory, i.e. `cd ..` pd() { + # Check argument count + if [ "$#" -gt 1 ] ; then + printf >&2 'pd(): Too many arguments\n' + return 2 + fi + # Change the positional parameters from the target to its containing # directory set -- "$( - # Check argument count - if [ "$#" -gt 1 ] ; then - printf >&2 'pd(): Too many arguments\n' - exit 2 - fi - # Figure out target dirname dirname=${1:-..} dirname=${dirname%/} |