shell編程例子 -- 一個簡單的目錄菜單
来源:互联网 发布:公共基础知识软件下载 编辑:程序博客网 时间:2024/05/19 23:14
root@desktop:~/bash# cat directory.sh
#!/bin/bash
until
echo List Directory..........1
echo Change Directory........2
echo Edit File...............3
echo Remove File.............4
echo Exit Menu...............5
read choice
test $choice = 5
do
case $choice in
1) ls;;
2) echo Enter target directory
read dir
cd $dir
;;
3) echo Enter file name
read file
vi $file
;;
4) echo Enter file name
read file
rm $file
;;
q|Q|5) echo Goodbye;;
*) echo illegal Option
esac
done
root@-desktop:~/bash#
因為各種原因,你可能不想讓某個用戶登陸在系統上,下面的腳本可以幫助你實現這個願望:
[root@foo /]# while true
> do
> kill -9 $(ps -aux |grep username | awk '{ print $2 }' )
> sleep 2
> done
shell編程例子 -- 一個簡單的目錄菜單
until
echo List Directory..........1
echo Change Directory........2
echo Edit File...............3
echo Remove File.............4
echo Exit Menu...............5
read choice
test $choice = 5
do
case $choice in
1) ls;;
2) echo Enter target directory
read dir
cd $dir
;;
3) echo Enter file name
read file
vi $file
;;
4) echo Enter file name
read file
rm $file
;;
q|Q|5) echo Goodbye;;
*) echo illegal Option
esac
done(http://www.fanqiang.com)
- shell編程例子 -- 一個簡單的目錄菜單
- 一个shell的例子
- C-shell的例子
- shell的一些例子
- 【Shell】记录shell的应用例子
- 一个ftp shell的例子
- shell的重定向例子
- shell例子的延伸思考
- shell 脚本的case例子
- shell编程的小例子
- shell脚本的循环 例子
- shell 脚本的case例子
- 简单的shell scripts例子
- shell例子
- 一个带参数的Shell的例子
- spark-shell的wordcount的例子存档
- shell---shell小例子
- shell 变量设置的技巧及例子
- “状态位”虽小,却有学问
- xp_cmdshell 用法
- javascript写的表格排序
- 二进制字节字符转换为ASCII的方法
- English Corner
- shell編程例子 -- 一個簡單的目錄菜單
- error LNK2019: unresolved external symbol "public: referenced in function LNK1120: 6 unresolved externals错误解决办法
- 在windows下下载android源码(转载)
- mysql-C编程(一)mysql错误码,关于mysql_errno
- log4j支持Syslog-ng的改造
- 日期类型与字符串类型相互转换工具类
- java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()
- .Net 编辑利器 Fckeditor 2.6.6 安装使用
- 【原创】 EXTJS JSON STRUTS2.1 树 (网上找的例子不能再2.1下直接运行,好一通改,弄好了发给大家)