Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 e0d7eb2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions keeporsweep.sh
Expand Up @@ -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.