学习shell --script的执行方式区别(source 、 shscript 、./script)

来源:互联网 发布:杨浦区人口普查数据 编辑:程序博客网 时间:2024/06/05 19:24
利用直接执行的方式来执行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]#



原创粉丝点击