摘要: 我们知道,使用位置变量可以获取传递给脚本的参数,但是位置变量最多只能获取9个参数,当要使用的选项、参数大于9时,位置变量就无能为力了。 一、使用shift命令处理参数 参数操作命令shift的用法比较特殊,它没有选项和参数,直接运行命令即可。运行shift命令时,位置变量就像一个可以移动的“指针”,每执行一次,位置变量指向的参数将向后移动一位。即使用shift命令后,位置变量$1的值等于使用s... 阅读全文
posted @ 2013-12-18 10:06 ITtecman 阅读(1122) 评论(0) 推荐(0) 编辑
摘要: [root@localhost shell]# cat monitor_disk.sh #!/bin/bash#This script is used to monitor disk.#2013/12/17function disk_speed(){ A=`df -k | grep "$1" | awk '{print $3}'` sleep 30 ... 阅读全文
posted @ 2013-12-18 09:26 ITtecman 阅读(325) 评论(0) 推荐(0) 编辑