linux shell脚本 引入外部shell文件
shell脚本 引入文件 文件包含的语法格式如下:# 注意点号(.)和文件名中间有一空格. filename# 或source filename实例:[root@hadoop01 shell]# vi test1.sh#!/bin/bashname=timo[root@hadoop01 shell]# vi
·
shell脚本 引入文件 文件包含的语法格式如下:
# 注意点号(.)和文件名中间有一空格
. filename
# 或
source filename
实例:
[root@hadoop01 shell]# vi test1.sh
#!/bin/bash
name=timo
[root@hadoop01 shell]# vi test2.sh
#!/bin/bash
tag="this is a boy"
[root@hadoop01 shell]# vi test3.sh
#!/bin/bash
. ./test1.sh
source ./test2.sh
echo $name$tag
[root@hadoop01 shell]# chmod a+x test3.sh
[root@hadoop01 shell]# ./test3.sh
timothis is a boy
更多推荐
已为社区贡献89条内容
所有评论(0)