aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-11 16:30:47 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-11 16:38:45 +1300
commit14b1071636d605771689c0f06c24647531b9d391 (patch)
tree8ebb4e67d372b4c7e05a3558c55ba0c96e12eabf /sh
parentStill untangling the shell highlighting mess (diff)
downloaddotfiles-14b1071636d605771689c0f06c24647531b9d391.tar.gz
dotfiles-14b1071636d605771689c0f06c24647531b9d391.zip
Use opening parens for case safety in subshell
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/bd.sh12
-rw-r--r--sh/shrc.d/sd.sh8
2 files changed, 10 insertions, 10 deletions
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh
index 14d65c3b..1043a8cb 100644
--- a/sh/shrc.d/bd.sh
+++ b/sh/shrc.d/bd.sh
@@ -22,28 +22,28 @@ bd() {
case $req in
# Just go straight to the root or dot directories if asked
- /|.|..)
+ (/|.|..)
dirname=$req
;;
# Anything with a leading / needs to anchor to the start of the
# path. A strange request though. Why not just use cd?
- /*)
+ (/*)
dirname=$req
case $PWD in
- "$dirname"/*) ;;
- *) dirname='' ;;
+ ("$dirname"/*) ;;
+ (*) dirname='' ;;
esac
;;
# In all other cases, iterate through the PWD to find a match, or
# whittle the target down to an empty string trying
- *)
+ (*)
dirname=$PWD
while [ -n "$dirname" ] ; do
dirname=${dirname%/*}
case $dirname in
- */"$req") break ;;
+ (*/"$req") break ;;
esac
done
;;
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index 80cb7e39..ce59bf99 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -53,7 +53,7 @@ sd() {
else
for sib in ../.* ../* ; do
case ${sib#../} in
- .|..|"${PWD##*/}") continue ;;
+ (.|..|"${PWD##*/}") continue ;;
esac
set -- "$@" "$sib"
done
@@ -61,12 +61,12 @@ sd() {
# We should have exactly one sibling
case $# in
- 1) ;;
- 0)
+ (1) ;;
+ (0)
printf >&2 'sd(): No siblings\n'
exit 1
;;
- *)
+ (*)
printf >&2 'sd(): More than one sibling\n'
exit 1
;;