linux-tutorial/codes/shell/示例脚本/脚本函数/脚本库.sh

21 lines
193 B
Bash
Raw Normal View History

2019-05-10 11:17:57 +08:00
#!/bin/bash
# myscript functions
function addem {
echo $[ $1 + $2 ]
}
function multem {
echo $[ $1 * $2 ]
}
function divem {
if [ $2 -ne 0]
then
echo $[ $1/$2 ]
else
echo -1
fi
}