基本上,我試圖退出包含循環的子殼。這裏是代碼: ` stop=0
( # subshell start
while true # Loop start
do
sleep 1 # Wait a second
echo 1 >> /tmp/output # Add a line to a test file
if [ $stop
我希望有人可以幫助將db2命令的輸出應用於一個變量,以便稍後在腳本中使用。 到目前爲止,我在... db2 "connect to <database> user <username> using <password>"
while read HowMany ;
do
Counter=$HowMany
echo $HowMany
done < <(db2 -x "SEL
bash shell腳本可以將給定的字符串按空間拆分爲1D數組。 str="a b c d e"
arr=($str)
# arr[0] is a, arr[1] is b, etc. arr is now an array, but what is the magic behind?
但是,究竟發生了什麼,當我們可以arr=($str)?我的理解是這裏的括號創建了一個子shell,但之