Skip to content

Instantly share code, notes, and snippets.

@elkoniu
Created May 20, 2020 12:40
Show Gist options
  • Save elkoniu/1aa4272bfb4854bb8ed8124d00d8c031 to your computer and use it in GitHub Desktop.
Save elkoniu/1aa4272bfb4854bb8ed8124d00d8c031 to your computer and use it in GitHub Desktop.
Prompt example
#!/bin/bash
dialog --title "Delete file" \
--backtitle "Linux Shell Script Tutorial Example" \
--yesno "Are you sure you want to permanently delete \"/tmp/foo.txt\"?" 7 60
# Get exit status
# 0 means user hit [yes] button.
# 1 means user hit [no] button.
# 255 means user hit [Esc] key.
response=$?
case $response in
0) echo "File deleted.";;
1) echo "File not deleted.";;
255) echo "[ESC] key pressed.";;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment