請問shell script中export環境變數的問題 - Linux

Frederica avatar
By Frederica
at 2008-09-15T22:54

Table of Contents

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
如有離題,請略過;如有錯誤,請回報;如有不懂,請再問;如有幫助,請享用;如有感謝,請告知

--
Tags: Linux

All Comments

Harry avatar
By Harry
at 2008-09-20T10:05
感謝~ 我問的是第二個

mysql資料庫匯出

Mary avatar
By Mary
at 2008-09-15T22:31
※ 引述《kadok (暗夜流星)》之銘言: : 我的mysql資料庫匯出 : 不論是透過phpmyadmin : 或是文字介面的mysqldump(該使用者locale為big5) : 結果都是亂碼 : 我的架站程式都是建構在big5上面的 : 應該內容資料的編碼也是big5 : 可是我怎麼樣都匯不出正確的 ...

mysql資料庫匯出

Brianna avatar
By Brianna
at 2008-09-15T20:06
我的mysql資料庫匯出 不論是透過phpmyadmin 或是文字介面的mysqldump(該使用者locale為big5) 結果都是亂碼 我的架站程式都是建構在big5上面的 應該內容資料的編碼也是big5 可是我怎麼樣都匯不出正確的資料庫sql 匯出來的資料 中文字的地方都是亂碼 殘念 ...

請問shell script中export環境變數的問題

Cara avatar
By Cara
at 2008-09-15T20:04
如果現在有兩個script script1和script2 內容分別是 #script2 export PORT=Linux #end of file ============= #script1 ./script2 echo $PORT #end of file 請問有辦法讓script2中e ...

急問 關於架站在linux上

Victoria avatar
By Victoria
at 2008-09-15T17:45
※ 引述《Mengfanwei (棒球andamp;LIFe!!)》之銘言: : 我們實驗室之前架了一個網站在lixux上面 : 現在一改網站內容的東西 : 我只大概知道一些語法 要去更改and#34;index.htmland#34;這個裡面的語法 : 現在問題是 當初不是我架的(我也不是很懂) : ...

急問 關於架站在linux上

Jake avatar
By Jake
at 2008-09-15T17:39
因應該就在/var/www 裡面就會有index.html的檔案了 - ...