Nathan Berrigan
Nathan Berrigan

Reputation: 11

I get Unexpected End of File when i try and Run this Script

echo "Gateway: 192.168.0.1 | Interface: Wlan0" 
echo "###########################"
echo "1) Update Kali                    4) Thanks too.."
echo "2) Software and System Tools      5) Must View"
echo "3) Install Hacking Tools  6) Terminate Program"
echo ""
read Option1 Option2 Option3 Option4 Option4 Option5 Option6

if [ "$Option1" = "1" ]; then
echo "Test"
clear
if [ "$Option2" = "2" ]; then
echo "test"
clear
if [ "$Option3" = "3" ]; then
echo "Test"
clear
if [ "$Option4" = "4" ]; then
echo "chicken"
clear
if [ "$Option5" = "5" ]; then
echo "Test"
clear
if [ "$Option6" = "6" ]; then
echo "The End"
clear

Upvotes: 0

Views: 32

Answers (1)

glenn jackman
glenn jackman

Reputation: 246807

The more robust way to present a menu is the select command

choices=(
  "Update Kali"
  "Software and System Tools"
  "Install Hacking Tools"
  "Thanks too.."
  "Must View"
  "Terminate Program"
)
PS3="Your choice: "
select choice in "${choices[@]}"; do
    case $choice in
        "${choices[0]}")
            echo "Test"
            ;;
        "${choices[1]}")
            echo "test"
            ;;
        "${choices[2]}")
            echo "Test"
            ;;
        "${choices[3]}")
            echo "chicken"
            ;;
        "${choices[4]}")
            echo "Test"
            ;;
        "${choices[5]}")
            echo "The End"
            ;;
    esac
    break
done
clear

Upvotes: 2

Related Questions