脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|shell|

服务器之家 - 脚本之家 - shell - Shell中调用、引用、包含另一个脚本文件的三种方法

Shell中调用、引用、包含另一个脚本文件的三种方法

2023-01-28 14:17shell编程教程 shell

这篇文章主要介绍了Shell中调用、引用、包含另一个脚本文件的三种方法,需要的朋友可以参考下

脚本 first (测试示例1)
first
#!/bin/bash
echo 'your are in first file'

方法一:使用source

#!/bin/bash
echo 'your are in second file'
source first

方法二:使用.

#!/bin/bash
echo 'your are in second file'
. first

方法三:使用sh
#!/bin/bash
echo 'your are in second file'
sh  first

延伸 · 阅读

精彩推荐