Linux Command Line and....ch18(select函数?)
来源:互联网 发布:淘宝电子琴小天吏 编辑:程序博客网 时间:2024/06/11 21:14
第三部分高级shell脚本编程スタート
本章内容:
- 创建文本菜单
- 创建文本窗口部件
- 添加X Window图形
18.1 创建文本菜单
function diskspace { clear df -k }function whoseon { clear who }function memusage { clear cat /proc/meminfo}PS3="Enter option: "select option in "Display disk space" "Display logged on users" "Display memory usage" "Exit program"do case $option in "Exit program") break ;; "Display disk space") diskspace ;; "Display logged on users") echo "Monday";; "Display memory usage") memusage ;; *) clear echo "Sorry, wrong selection";; esacdone clear
(select运行有问题,无法匹配)
#!/bin/bash# using a variable to hold the listfunction diskspace { clear df -k }function whoseon { clear who }function memusage { clear cat /proc/meminfo}function menu { clearechoecho -e "\t\t\tSys Admin Menu\n"echo -e "\t1. Display disk space"echo -e "\t2. Display logged on users"echo -e "\t3. Display memory usage"3echo -e "\t0. Exit program\n\n"echo -en "\t\tEnter option: "read -n 1 option}while [ 1 ] do menu case $option in 0) break ;; 1) diskspace ;; 2) whoseon ;; 3) memusage ;; *) clear echo "Sorry, wrong selection";; esac echo -en "\n\n\t\t\tHit any key to continue" read -n 1 linedoneclear
18.2 制作窗口
阅读全文
0 0
- Linux Command Line and....ch18(select函数?)
- Linux Command Line and....ch10(编辑器)
- Linux Command Line and....ch1(初识linux)
- Linux Command Line and....ch6(使用linux环境变量)
- Linux Command Line and....ch7(理解Linux文件权限)
- linux command Line and shell script bible(笔记四)
- linux command Line and shell script bible(笔记五)
- linux command Line and shell script bible(笔记七)
- linux command Line and shell script bible(笔记八)
- linux command Line and shell script bible(笔记九)
- linux command Line and shell script bible(笔记十)
- linux command Line and shell script bible(笔记十一)
- linux command Line and shell script bible(笔记十二)
- linux command Line and shell script bible(笔记十三)
- linux command Line and shell script bible(笔记十四)
- linux command Line and shell script bible(笔记十五)
- linux command Line and shell script bible(笔记十六)
- linux command Line and shell script bible(笔记十七)
- 设计模式浅析
- MP4格式基本概念——非常详细,神文
- 获取自己的第一枚比特币
- 【分享】nativefier-用一行代码将任意网页转化为桌面应用
- angular-daterangepicker实例
- Linux Command Line and....ch18(select函数?)
- 页面元素属性
- win10下Visual Studio2015+cuda8.0+cudnn v5.1+Anaconda4.4.0+tensorflow+Keras+Pycharm+OpenCV3.2.0安装教程
- zigbee基本概念及组网特性简介
- mp4文件格式解析——直接上代码,详细
- Android proguard(混淆)模板
- libdpush_v2_3.so:unauthorized access to "libssl.so"
- svn忘记密码不用找管理员最直接的办法
- 查询表中最后四十条数据