[root@linux1 fd]# myDemo(){ echo 'niu'; aaa='bin'; echo $aaa; }
[root@linux1 fd]# myDemo
niu
bin
[root@linux1 fd]# echo $aaa
bin
[root@linux1 fd]# myDemo1(){
> echo 'niu'
> local bbb='bin'
> echo $bbb
> }
[root@linux1 fd]# myDemo1
niu
bin
使用占位符
[root@linux1 sh]# ll
total 4
-rwxr-xr-x. 1 root root 57 Feb 21 16:39 sh01.sh
[root@linux1 sh]# vi sh02.sh
"sh02.sh" [New] 0L, 0C written
[root@linux1 sh]# vi sh02.sh
[root@linux1 sh]# source sh02.sh a b
a
b