0
我試圖做一個簡單的shell腳本來ping的來源,但我得到Shell腳本For循環語法錯誤
bash-2.03$ ./test.sh google.com 10 .5 /home/users/me 16 256
./test.sh: line 35: syntax error near unexpected token `(('
./test.sh: line 35: `for ((i = 1 ; i <= $totalArguments ; i++))'
這是代碼:
#!/bin/bash
ip=$1
count=$2
interval=$3
outputDirectory=$4
shift;
shift;
shift;
shift;
totalArguments=$#
for ((i = 1 ; i <= $totalArguments ; i++))
do
ping -c $count -i $interval -s ${!i} $ip >> $outputDirectory/${!i}results.txt
done
有人能告訴我是什麼我對for循環語法做錯了嗎? 謝謝!
for循環語法看起來不錯。 – Inv3r53 2010-06-08 17:31:34
腳本在bash 3.2.49版本上的工作原理。 – 2010-06-08 17:34:40