aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-18 17:36:41 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-18 17:36:41 +1200
commite6ffda0bbd6343e58ea40e79a724977eda51ac30 (patch)
treecd475ea52f11e7011d8cba2ebe56c3b068516d96
parentApply XDG to xyzzy(6df) (diff)
downloaddotfiles-e6ffda0bbd6343e58ea40e79a724977eda51ac30.tar.gz
dotfiles-e6ffda0bbd6343e58ea40e79a724977eda51ac30.zip
Clean up xyzzy(6df) a bit
-rw-r--r--games/xyzzy.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/games/xyzzy.sh b/games/xyzzy.sh
index b4fc4695..ebf3959a 100644
--- a/games/xyzzy.sh
+++ b/games/xyzzy.sh
@@ -1,8 +1,11 @@
# ADVENTURE
-state=${XDG_CONFIG_HOME:-$HOME/.config}/xyzzy/dest
-mkdir -p -- "${state%/*}"
-if [ -e "$state" ] ; then
- printf >&2 '%s\n' 'Nothing happens.'
- exit 1
+dir=${XDG_CONFIG_HOME:-$HOME/.config}/xyzzy
+if ! [ -d "$dir" ] ; then
+ mkdir -- "$dir" || exit
fi
-printf '%s\n' 'I see no cave here.' > "$state"
+if [ -e "$dir"/dest ] ; then
+ printf >&2 'Nothing happens.\n'
+else
+ printf 'I see no cave here.\n' > "$dir"/dest
+fi
+exit 1