shell中的函数、shell的数组、告警系统需求分析
# vim fun1.sh # cat fun1.sh#!/bin/bash
function inp(){
echo $1 $2 $3 $0 $#
}
inp 1 a 2
# sh fun1.sh
1 a 2 fun1.sh 3
# sh -x fun1.sh
+ inp 1 a 2
+ echo 1 a 2 fun1.sh 3
1 a 2 fun1.sh 3
# vi fun1.sh
# cat fun1.sh
#!/bin/bash
function inp(){
echo "The first par is $1"
echo "The second par is $2"
echo "The third par is $3"
echo "the scritp name is $0"
echo "the number of par is $#"
}
inp b a 2 3 adf
# sh fun1.sh
The first par is b
The second par is a
The third par is 2
the scritp name is fun1.sh
the number of par is 5
# sh -x fun1.sh
+ inp b a 2 3 adf
+ echo 'The first par is b'
The first par is b
+ echo 'The second par is a'
The second par is a
+ echo 'The third par is 2'
The third par is 2
+ echo 'the scritp name is fun1.sh'
the scritp name is fun1.sh
+ echo 'the number of par is 5'
the number of par is 5
#
页:
[1]