ソースを使用してメインから 2 つのシェル スクリプトを実行しています。
main.sh
#/bin/sh
a=1
b=2
c=3
gnome-terminal -x sh -c ". ./test1.sh|less" (note the source ".")
gnome-terminal -x sh -c ". ./test2.sh|less"
...
...
test1.sh
#!/bin/sh
echo "a="$a #doesn't print anything
次の 2 を個別に実行できましたが、組み合わせると、メインの変数に他のファイルにアクセスできません 1. gnome-terminal -x sh -c "test1.sh|less" #別のターミナルで実行可能 2 . . ./test1.sh #test1.sh の main.sh から変数にアクセス可能