The usage of "source ./xxx.sh"

来源:互联网 发布:js多图上传预览 编辑:程序博客网 时间:2024/06/12 00:57

在shell脚本中定义了一些函数

使用 source xxx.sh之后, 就可以在shell中直接执行这些函数

[frank@apollo misc]$ cat test_function.sh
# /bin/sh

function hellofunc () {
    echo "hello"
}

[frank@apollo misc]$ source ./test_function.sh

 

这时就可以在console中执行"hellfunc"命令

[frank@apollo misc]$ hellofunc
hello

原创粉丝点击