那些年写过的shell----select的使用

来源:互联网 发布:手机蟑螂魔术软件 编辑:程序博客网 时间:2024/05/22 16:52
#! /bin/bash
################################################
##Author:   freeking
##Created:  Oct 27th 2013
##Description  the useage of select and PS3
################################################

PS3="select a day(1=4):"

select i in mon tue wed exit
do
    case $i in
    mon) echo "Monday";;
    tue) echo "Tuesday";;
    wed) echo "Wedneaday";;
    exit) exit;
    esac

done


PS3="select a day(1=4):"做为脚本的提示符。

PS1:系统提示符($,#,\)

PS2:   系统换行提示符(->)

PS4:   用户自定义提示符,

export PS4='$0.$LINENO+ '

出处:http://linux.101hacks.com/linux-prompts

原创粉丝点击