2012-09-04 55 views
1

假設我有兩個腳本,printargs.sh:如何在bash變量中存儲arg和引用的arg值?

#!/bin/bash 

echo 1=$1 
echo 2=$2 
echo 3=$3 

和passargs.sh:

#!/bin/bash 

arg1="-e \"hello there\"" 
./printargs.sh $arg1 

如何修改passargs.sh傳遞兩個參數,-ehello there,以printargs。 SH?即我想printargs.sh打印

1=-e 
2=hello there 
3= 

我覺得這個問題困擾了我多年!我能得到它的唯一方法是創建兩個變量。任何幫助將不勝感激。

回答