#!/bin/bash
my_fun() {
echo ' inside function is '
echo ' inside function is '
echo ' inside function is '
}
echo ' outside function is '
echo ' outside function is '
echo ' outside function is '
my_fun fp1 "fp2 fp3"
chmod +x my.sh
./my.sh p1 "p2 p3"
outside function is ./my.sh
outside function is p1
outside function is p2 p3
inside function is ./my.sh
inside function is fp1
inside function is fp2 fp3
$@ 與 $* 差在哪了代码: #!/bin/bash
my_fun() {
echo "$#"
}
echo 'the number of parameter in "$@" is '$(my_fun "$@")
echo 'the number of parameter in "$*" is '$(my_fun "$*")