当我尝试运行此脚本时,我收到了意外的文件结尾

时间:2017-08-25 00:26:19

标签: linux bash

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

1 个答案:

答案 0 :(得分:2)

呈现菜单的更健壮的方法是select命令

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