shell-select语句

#!/bin/bash
echo "what is your favourite os ?"
select name in "linux" "window" "mac" "unix"
do
        echo $name
done
echo "you have selected $name"

在这里插入图片描述

#!/bin/bash
select i in a b c d
do
    case $i in
        a)
            echo "Your choice is a"
        ;;
        b)
            echo "Your choice is b"
        ;;
        c)
            echo "Your choice is c"
        ;;
        d)
            echo "Your choice is d"
        ;;
        *)
            echo "Wrong choice! exit!"
        ;;
    esac
done

在这里插入图片描述

发布了70 篇原创文章 · 获赞 0 · 访问量 1286

猜你喜欢

转载自blog.csdn.net/AaNiceMan/article/details/104315077