[英]Shell Scripting For loop Syntax Error
I am trying to make a simple shell script to ping a source but I am getting 我正在尝试制作一个简单的Shell脚本来ping源,但是我正在
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++ ))'
This is the code: 这是代码:
#!/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
Can someone tell me what I am doing wrong with the for loop syntax? 有人可以告诉我for循环语法在做什么吗? Thanks!
谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.