Linux Command Line and....ch18(select函数?)
2017-06-27 13:05
489 查看
第三部分高级shell脚本编程スタート
本章内容:
创建文本菜单
创建文本窗口部件
添加X Window图形
18.1 创建文本菜单
(select运行有问题,无法匹配)
18.2 制作窗口
本章内容:
创建文本菜单
创建文本窗口部件
添加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";; esac done clear
(select运行有问题,无法匹配)
#!/bin/bash # using a variable to hold the list function diskspace { clear df -k } function whoseon { clear who } function memusage { clear cat /proc/meminfo } function menu { clear echo echo -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"3 echo -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 line done clear
18.2 制作窗口
相关文章推荐
- Linux Command Line and....ch1(初识linux)
- Linux Command Line and....ch14(处理用户输入)
- Linux Command Line and....ch13(更多的结构化命令——循环)
- Linux Command Line and....ch25(使用MySQL)
- 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 Scripting Bible__第9章
- 18 Command Line Tools to Monitor Linux Performance
- 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 Scripting Bible__第11章
- 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(笔记九)
- 18 Command Line Tools to Monitor Linux Performance