diff options
-rw-r--r-- | games/xyzzy.sh | 15 |
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 |