Bash 无法意识到是否在while循环中

Bash 无法意识到是否在while循环中,bash,if-statement,while-loop,Bash,If Statement,While Loop,请帮帮我。我不知道是否在里面,而: while IFS=';' read one two three; do if (( $three >= 1 )) #this is a line that i can't understand then X=$(for i in $two do BIN=$(echo "obase=10; ibase=16; $i" | bc ) echo $BIN done) fi done < /testcsv.csv 输出为

请帮帮我。我不知道是否在里面,而:

    while IFS=';' read one two three; 
do

if (( $three >= 1 )) #this is a line that i can't understand

then X=$(for i in $two
   do BIN=$(echo "obase=10; ibase=16; $i" | bc )
   echo $BIN
   done)
fi
done < /testcsv.csv
输出为:

./test.sh: line 34: ((: <= 1 : syntax error: operand expected (error token is "<= 1 ")

bash中IF的语法如下所示:

if [ conditional expression ]
就你而言:

if [ $three >= 1 ]

你写的第34行到底是哪一部分?你确定你提供了足够的信息来阅读吗?当出现提示时,您应该输入三个用分号分隔的术语,最后一个术语应该是一个数字,很可能这就是您在获取错误时遗漏的内容,第二个术语应该是用空格分隔的十六进制数字列表。但老实说,这是一段可怕的代码,它需要代码注入。不要用它,是吗?我刚刚用他的语法对OSX Bash 3.2.53做了一个简短的测试,得到的错误标记是。。事情由我的示例中的括号解决。@mattias in test,>=进行词法排序测试。相反,在现代bash中,$three>=1进行数值比较。如果在OSX上不可用,那么OP可能需要[$3-GE1]。