我有運行爲下面的腳本:化妝用戶輸入循環變量
>> bash test.sh < 0 0
內test.sh
read $sni
read $snf
echo 'Run between '$sni' and '$snf
for i in {sni..snf}
do
done
,但我得到了以下錯誤:
test.sh: line 14: [: {sni..snf}: integer expression expected
test.sh: line 19: [: {sni..snf}: integer expression expected
如何製作循環變量整數?謝謝。
另外,你應該使用'read sni',因爲你*不需要在那裏插入可變插值。 – jpaugh 2013-05-10 22:35:22
@jpaugh廣告1)可悲的是,你不能。如果你想在這裏使用變量,你必須使用'seq'(無論如何都使用'bash')。 – 2013-05-10 22:39:36
哎唷!哇!你是對的。 – jpaugh 2013-05-10 22:42:04