在一個sh腳本中執行另一個sh腳本
使用:
. ./t0.sh
source ./t0.sh
中間有一空格
eg:
[root@k8s-master test3]# ll
總用量 8
-rw-r--r--. 1 root root 28 3月 21 01:15 t0.sh
-rw-r--r--. 1 root root 60 3月 21 01:16 t2.sh
[root@k8s-master test3]# sh t2.sh
Hello world
[root@k8s-master test3]# cat t0.sh
#!/bin/bash
hello="Hello"
[root@k8s-master test3]# cat t2.sh
#!/bin/bash
. ./t0.sh
# source ./t0.sh
echo "$hello world"
[root@k8s-master test3]#