摘要: 2016/06/10 创建交互式shell脚本最常用的方法是使用菜单。提供各种选项可以帮助脚本用户了解脚本能做什么,不能做什么;通常菜单脚本会清空显示区域,然后显示可用的选项列表。用户可以按下与每个选项关联的字母或数字来选择选项 Shell脚本菜单的核心是case命令,case命令会根据用户在菜单上 阅读全文
posted @ 2016-06-11 15:32 行走的思想 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 2016/06/10 1.反引号 反引号和波浪线(~)位于同一键位 反引号允许你将shell命令的输出赋给变量 #!/bin/bash today=`date +%y%m%d` ls /usr/bin -al > log.$today log.160610 2. 单引号 和 双引号 echo 命令能 阅读全文
posted @ 2016-06-11 14:42 行走的思想 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 2016/06/10 1. 脚本中使用函数 创建函数的格式,有两种: function name { commands } 或 name() { commands } #!/bin/bash #using a function in a script function func1 { echo "T 阅读全文
posted @ 2016-06-11 14:31 行走的思想 阅读(10) 评论(0) 推荐(0) 编辑