Re: [問題] 請問shell script中export環境變數的問題

看板Linux作者 (ChiuCS)時間17年前 (2008/09/15 22:54), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/3 (看更多)
think about #1) 'export' to next script #script2-------- export PORT=Linux ./script1 #=============== #script1-------- echo $PORT #=============== #2) 'source' from provious script #script2------- PORT=Linux #============== #script1------- . ./script1 #source ./script1 echo $PORT #============= I think you are ask about #2 ※ 引述《wahoho (..)》之銘言: : 如果現在有兩個script : script1和script2 : 內容分別是 : #script2 : export PORT=Linux : #end of file : ============= : #script1 : ./script2 : echo $PORT : #end of file : 請問有辦法讓script2中export的變數繼續存在script1裡面嗎? -- Sincerely Yours, I_Love_Linux 如有離題,請略過;如有錯誤,請回報;如有不懂,請再問;如有幫助,請享用;如有感謝,請告知 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 221.169.88.17

09/16 04:58, , 1F
感謝~ 我問的是第二個
09/16 04:58, 1F
文章代碼(AID): #18pdSkUF (Linux)
文章代碼(AID): #18pdSkUF (Linux)