aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/sd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh/shrc.d/sd.sh')
-rw-r--r--sh/shrc.d/sd.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index 80ae7c12..c5b1106a 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -1,6 +1,6 @@
#
-# sd -- sibling/switch directory -- Shortcut to switch to another directory
-# with the same parent, i.e. a sibling of the current directory.
+# Shortcut to switch to another directory with the same parent, i.e. a sibling
+# of the current directory.
#
# $ pwd
# /home/you
@@ -34,14 +34,14 @@
#
sd() {
+ # Check argument count
+ if [ "$#" -gt 1 ] ; then
+ printf >&2 'sd(): Too many arguments\n'
+ return 2
+ fi
+
set -- "$(
- # Check argument count
- if [ "$#" -gt 1 ] ; then
- printf >&2 'sd(): Too many arguments\n'
- exit 1
- fi
-
# Set the positional parameters to either the requested directory, or
# all siblings of the current directory if no request
spec=$1