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

来源:互联网 发布:知与行杂志 编辑:程序博客网 时间:2024/05/10 07:00

假设文件first.sh内容如下:

#!/bin/bash

echo'your are in first file'

1使用source

#!/bin/bash

echo'your are in second file'

sourcefirst

2使用.

#!/bin/bash

echo'your are in second file'

.first

注:.后面有一个空格。

3使用sh

#!/bin/bash

echo'your are in second file'

sh  first

0 0