Bash for循环错误

时间:2013-10-03 04:36:27

标签: bash

我在bash中有一个脚本,从第8列的LocLog中获取ip:

#!/bin/bash
for i in $(cat /scripts/logs/LocLog | awk '{print $8}' | sort | uniq); 
do 
    php /scripts/a.php $i; 
done

脚本出错:

bash -x log
'og: line 2: syntax error near unexpected token `
'og: line 2: `for i in $(cat /scripts/logs/LocLog | awk '{print $8}' | sort | uniq);

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

摆脱for行末尾的分号。