我有兩個shell腳本文件。一個是在系統上安裝某些東西的通用文件,而另一個是處理安裝步驟的文件。使用nohup從shell腳本調用和返回值
文件1:主安裝文件 文件2:安裝文件援助
我使用
nohup ./file2.sh $1 </dev/null >../logs/schema.log 2>&1 &
schema_status=$?
echo $schema_status
,因爲現在的nohup的schema_status值總是來爲0調用從文件1文件2。
如何從file2將相關值返回到file1。
file2中,我添加了一個return語句:
if (condition)
then
exit 101
else
exit 102
fi