CLI Tools bash Intermediate

Interactive Menu with select

Bash select menu for interactive scripts — no external dependencies.

bash
#!/bin/bash
PS3='Choose an action: '
options=(Deploy Rollback 'View logs' Exit)
select opt in "${options[@]}"; do
  case $opt in
    Deploy)    bash deploy.sh ;;
    Rollback)  bash rollback.sh ;;
    'View logs') journalctl -u myapp -n 100 --no-pager ;;
    Exit)      break ;;
    *) echo 'Invalid option' ;;
  esac
done

Prerequisites

  • bash >= 4

Pro Tips

  • → Set PS3 to change the prompt text.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Intermediate
Read time
2 min
Published
May 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.