了解 bash 脚本以获取下拉选项

了解 bash 脚本以获取下拉选项

我有这个脚本,它读取用户输入以执行某些命令,这工作正常。

User=0
Path="/root/file/"
Path1="/root/domain/samples/file"
echo "Please select k1  l3  l8  o5  s2  s1  v1"
echo Location "Select the location eg: [k1 l3 l8 o5 s2 s1 v1]? "
read User
if [ $User = kw1 ]
    then
            echo unlink file
            echo ln -s $Path/$User $Path1/file
elif [ $User = lb3 ]
    then
            echo unlink file
            echo ln -s $Path/$User $Path1/file
elif [ $User = lo8 ]
    then
            echo unlink file
            echo ln -s $Path/$User $Path1/file  
            cp -p /domain/samples /domain/samples-org
            cp -p /root/l3 /domain/samples
else
echo "Specified location does not exist"
fi

问题

我正在考虑有一个如下所示的下拉菜单,例如。可能的方法是什么?

#./script
    Eg: Please select from the below menu 
    1. Location k1  
    2. Location l3  
    3. Location l8  
    4. Location o5  
    5. Location s2  
    6. Location s1  
    7. Location v1
Enter number: 4 
Selected o5
Configuring.....

相关内容