我有兩個文件調用a_file和b_file。我正在嘗試寫入a_file,以便它可以更改b_file中的變量。UNIX,如何從另一個文件更改腳本文件?
echo "This is a_file"
echo "Enter x to display msg1 or y to display msg2"
read input
和
echo "This is b_file"
if [ "$var1" = "x" ]; then
echo "message 1"
else
echo "message 2"
fi
你能告訴我怎麼能操縱變量var1
從a_file?
這是對khachik的答案的更新。這很清楚。但是如果我想在第一次執行a_file後每分鐘運行一次b_file, (crontab)我應該如下編寫它。
echo "This is a_file"
echo "Enter x to display msg1 or y to display msg2"
read x
* * * * * ./b_file "$x"
和
echo "This is b_file"
if [ "$1" = "x" ]; then
echo "message 1"
else
echo "message 2"
fi
你試圖解決什麼問題? http://www.perlmonks.org/index.pl?node_id=542341 – Johnsyweb 2010-11-15 07:43:30