与C/C++语言类似,shell脚本语言也有文件包含
使用方法:
(1). filename # 注意点号(.)和文件名中间有一空格
(2)source filename
例子:
#test1.sh的内容
#!/bin/sh
ab="asn"
#test2.sh的内容
#!/bin/sh
. ./test1.sh
echo $ab
执行效果:
与C/C++语言类似,shell脚本语言也有文件包含
使用方法:
(1). filename # 注意点号(.)和文件名中间有一空格
(2)source filename
例子:
#test1.sh的内容
#!/bin/sh
ab="asn"
#test2.sh的内容
#!/bin/sh
. ./test1.sh
echo $ab
执行效果: