我有這個腳本,我從特定檔案中獲得了基本的 grep 幫助
它使用 Ksh 在 RHEL 8 上作業,但在我使用 AIX 7.1 時不起作用。
給我這個錯誤:0404-057 第 6 行的語法錯誤:'(' 不是預期的
我的腳本:
#!/use/bin/ksh
If [[ $# -eq 0]];
Then
Echo"add value please"
Else
For ((I = $#; I > 0; i--)); do
Grep -w -- "$1" responselist.lst || echo "'$1' not found"
Shift
Done
Fi
uj5u.com熱心網友回復:
建議嘗試:
#!/use/bin/ksh
if [[ "$#" -eq 0 ]]; then
echo "add value please"
else
for ((i = $#; i > 0; i--)); do
grep -w "$1" responselist.lst || echo "$1 not found"
Shift
done
fi
uj5u.com熱心網友回復:
感謝@shawn 的回答。
問題是版本
這有效
/usr/bin/ksh93
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/470209.html