Skip to content
Permalink
Browse files

Add 'Keep or Sweep' choice to shell script

Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
  • Loading branch information...
jancborchardt committed May 10, 2019
1 parent e5538d5 commit e0d7eb210837e30b85d725c9bc1673a495845ef5
Showing with 10 additions and 0 deletions.
  1. +10 −0 keeporsweep.sh
@@ -20,3 +20,13 @@ if [ "$(uname)" == "Darwin" ]; then
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
xdg-open "$RANDOMFILE" # Linux
fi

# Ask for Keep or Sweep
# https://stackoverflow.com/questions/226703/how-do-i-prompt-for-yes-no-cancel-input-in-a-linux-shell-script/27875395#27875395
echo "Keep or Sweep $RANDOMFILE?"
select ks in "Keep" "Sweep"; do
case $ks in
Keep ) echo "✔ KEPT $RANDOMFILE"; break;;
Sweep ) rm "$RANDOMFILE"; echo "❌ SWEPT $RANDOMFILE!"; exit;;
esac
done

0 comments on commit e0d7eb2

Please sign in to comment.
You can’t perform that action at this time.