Write a script:
1, create a function, you can accept the Inode or block two parameters, if the user passed other parameters, then return error message 53 to the main program;
If the parameter passed is an inode, the usage of all the file system Inode nodes on the current system is displayed;
If the parameter passed is block, the use of all file system blocks on the current system is displayed;
2, call this function;
The code is as follows:
#!/bin/bash
#Author: MOS
#Script name:funDinfo.sh
#Date & time:2012-10-09/21:44:16
#Version: 1.0.1
#Description:
#
#定义函数Disk_
disk_ () {
#case语句选择 case into
inode)
df-iph;; #显示inode信息, the following is block block
)
DF-PBH;
*) return
#如果输入不符合, End Function, pass value
Esac
}
#给出信息, read parameter
read-p "Please input [Inode|block]:" Info
#调用参数
disk_ $Info
#获取函数返回值, judging, if equal, output the following information
[$-eq] && echo "Input error, error num ber is 53 "