August 2, 2010
francislai 在天空部落發表於
Aug 2, 2010
鼓勵此日記:0
MainShell.sh
#! /bin/sh
echo "MainShell!"
echo "Now call subShell with 2 arguement"
LIT_PROJECT_NAME="HP"
LIT_MODEL_NAME="DT"
echo "LIT_PROJECT_NAME=$LIT_PROJECT_NAME" > LIT_config.lit
echo "LIT_MODEL_NAME=$LIT_MODEL_NAME" >> LIT_config.lit
sh SubShell.sh A 2
SubShell.sh
#! /bin/sh
echo "SubShell! $0"
echo "First arg = $1, second is $2"
alias GETMODEL='cat LIT_config.lit | grep 'LIT_MODEL_NAME' | cut -d '=' -f 2'
LITGETMODEL=$(GETMODEL)
echo "$LITGETMODEL"
執行結果
[francis@localhost TestShell]$ sh MainShell.sh
MainShell!
Now call subShell with 2 arguement
SubShell! SubShell.sh
First arg = A, second is 2
DT
#! /bin/sh
echo "MainShell!"
echo "Now call subShell with 2 arguement"
LIT_PROJECT_NAME="HP"
LIT_MODEL_NAME="DT"
echo "LIT_PROJECT_NAME=$LIT_PROJECT_NAME" > LIT_config.lit
echo "LIT_MODEL_NAME=$LIT_MODEL_NAME" >> LIT_config.lit
sh SubShell.sh A 2
SubShell.sh
#! /bin/sh
echo "SubShell! $0"
echo "First arg = $1, second is $2"
alias GETMODEL='cat LIT_config.lit | grep 'LIT_MODEL_NAME' | cut -d '=' -f 2'
LITGETMODEL=$(GETMODEL)
echo "$LITGETMODEL"
執行結果
[francis@localhost TestShell]$ sh MainShell.sh
MainShell!
Now call subShell with 2 arguement
SubShell! SubShell.sh
First arg = A, second is 2
DT








































