利用直接执行的方式来执行script:
[root@localhost shelldemo]# echo $firstname $lastname
[root@localhost shelldemo]# sh sh02.sh
Please input your first name : gao
Please input your last name : zhen'an
Your full name is :gao zhen'an
[root@localhost shelldemo]# echo $firstname $lastname
#
[root@localhost shelldemo]# source sh02.sh #利用source来执行脚本:在父进程中执行:
Please input your first name : gao
Please input your last name : zhenan
Your full name is :gao zhenan
[root@localhost shelldemo]# echo $firstname $lastname
gao zhenan
[root@localhost shelldemo]#