如何执行shell脚本?shell脚本执行办法

    /    2019-01-25

1. 执行脚本的办法

sh/bash   scripts.sh 
chown +x   ./scripts.sh  && ./scripts.sh  
source scripts.sh
. (空格) scripts.sh
cat oldboyedu.sh |bash  # 效率较低

source 与 . (点) 的作用

source命令

[root@oldboy ~]# help source  |head -2source: source 文件名 [参数]
    在当前 shell 中执行一个文件中的命令。

. (点)

[root@oldboy scripts]# help . |head -2.: . 文件名 [参数]
    在当前 shell 中执行一个文件中的命令。

2. sh 于 source的区别

(0)

分享至