Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
a simple way to select specific option
  • Loading branch information
mkromi committed Dec 1, 2021
commit 4eebbab0dfdd5ed697762a64d74b0c61c14e84c4
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ A collection of simple Bash scripts.
1. [Randomfile.sh](scripts/randomfile.sh): create unique file/folder automatically with date and time stamp
1. [Random-emoji.sh](scripts/random-emoji.sh): print ramdom emojis
1. [pomodoro.sh](scripts/pomodoro.sh): a simple pomodoro app written in bash
1. [options.sh](scripts/options.sh): a simple way to select specific option

## Programming

Expand Down
14 changes: 14 additions & 0 deletions scripts/options.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

OPTIONS="Hello Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "Hello" ]; then
echo Hello World
else
clear
echo bad option
fi
done