linux shell编程之菜单选择(一)
来源:互联网 发布:2017淘宝美工工资待遇 编辑:程序博客网 时间:2024/05/22 15:29
linux程序设计老师布置的作业:根据自己的写法和参考网上的
编一个shell 编写一个shell程序,使用shell编写一个菜单,分别实现列出以下内容:(1)目录内
容、(2)切换目录、(3)创建文件、(4)编辑文件、(5)删除文件的功能
#!/bin/shuntilecho "1.目录内容"echo "2.切换目录"echo "3.创建文件"echo "4.编辑文件"echo "5.删除文件"echo "6.退出菜单"read inputtest $input = 6docase $input in1)ls;;2)echo "enter target directory"read dircd $dir;;3)echo "enter a file name" read file touch $file;; 4)echo "enter a file name:"read filevi $file;;5)echo "enter a file name"read filerm $file;;6)echo "请输入选择(1-6)"esacdone
另一种写法出自:http://wolfchen.blog.51cto.com/2211749/964615
#!/bin/bashcat << EOF********please enter your choise:(1-6)****(1) List you selected directory(2) Change to you selected directory(3) Create a new file(4) Edit you selected file(5) Remove you selected file.(6) Exit Menu.EOFread -p "Now select the top option to: " inputcase $input in 1) ls;;2) echo "Enter target directory:"read dircd $dir;;3) echo "Enter a file name:"read filetouch $file;;4) echo "Enter a file name:"read filevi $file;;5) echo "Enter a file nmae:"read filerm $file;;esac
- linux shell编程之菜单选择(一)
- linux shell编程之菜单选择(二)
- Linux程序设计(Linux shell编程的例子:选择菜单)
- linux shell编程(一)
- Linux Shell 编程(一)
- Linux Shell 编程(一)
- linux shell 编程(一)
- linux shell 编程(一)
- Linux面试题之shell编程详解(一)
- Linux学习之shell编程一
- Linux下Shell编程之必背必记(一)
- Linux 下的 shell 编程之 if-else选择结构
- Linux 下的 shell 编程之 case 多分支选择
- Linux程序设计(Linux shell编程一)
- Linux Shell编程一
- linux之shell(一)
- Linux Shell编程(一)--Shell编程基础
- Linux中shell编程需要避免的坑之shell语法篇(一)
- power Designer 简单应用
- 使用集成块DIY计算机
- 流量的烦恼
- php ghook 全局钩子功能 v0
- MFC中PreTranslateMessage函数浅析
- linux shell编程之菜单选择(一)
- linux获取系统信息的常用命令
- 同一路由实现计算机共享
- 多人围成一圈报数问题!
- Python发送内嵌图片及附件
- ant + junit 测试。并生成测试报告
- ubuntu12.04下使用python-webqq
- Java中字符串转数字
- 忘记root密码解决方法一