Skip to main content
added 43 characters in body
Source Link
Petr Skocik
  • 29.7k
  • 18
  • 90
  • 155
#!/usr/bin/env bash 

echo "Select Your Options (Seperated by spaces): 1 2 3"
read selection

#exit(1) unless every component of $selection is one of 1, 2, or 3

set -f #to supress glob expansion
for input in $selection; do
  case "$input" in 1);; 2);; 3);; *) exit 1;; esac
done

for input in $selection; do
  case "$input" in
    1 ) echo "you selection option 1"
      ;;
    2 ) echo "you selection option 2"
      ;;
    3 ) echo "you selection option 3"
      ;;
  esac
done
#!/usr/bin/env bash
echo "Select Your Options (Seperated by spaces): 1 2 3"
read selection

#exit(1) unless every component of $selection is one of 1, 2, or 3
for input in $selection; do
  case "$input" in 1);; 2);; 3);; *) exit 1;; esac
done

for input in $selection; do
  case "$input" in
    1 ) echo "you selection option 1"
      ;;
    2 ) echo "you selection option 2"
      ;;
    3 ) echo "you selection option 3"
      ;;
  esac
done
#!/usr/bin/env bash 

echo "Select Your Options (Seperated by spaces): 1 2 3"
read selection

#exit(1) unless every component of $selection is one of 1, 2, or 3

set -f #to supress glob expansion
for input in $selection; do
  case "$input" in 1);; 2);; 3);; *) exit 1;; esac
done

for input in $selection; do
  case "$input" in
    1 ) echo "you selection option 1"
      ;;
    2 ) echo "you selection option 2"
      ;;
    3 ) echo "you selection option 3"
      ;;
  esac
done
Source Link
Petr Skocik
  • 29.7k
  • 18
  • 90
  • 155

#!/usr/bin/env bash
echo "Select Your Options (Seperated by spaces): 1 2 3"
read selection

#exit(1) unless every component of $selection is one of 1, 2, or 3
for input in $selection; do
  case "$input" in 1);; 2);; 3);; *) exit 1;; esac
done

for input in $selection; do
  case "$input" in
    1 ) echo "you selection option 1"
      ;;
    2 ) echo "you selection option 2"
      ;;
    3 ) echo "you selection option 3"
      ;;
  esac
done