什麼是錯的shell腳本如下代碼:shell腳本嵌套如果
下面的代碼拋出意外別的錯誤:未找到
if [ $result -eq 0 ];
then
echo "SFTP completed successfully to Prod Remote Server" >> $LOG_FILE
else
errorConnectToProd=1
if [[ $result -eq 4 || $result -eq 5 ]];
echo "FAILED to connect to Server. " >> $LOG_FILE
else
echo "FAILED to SFTP to Remote Server. " >> $LOG_FILE
fi
fi
以下行捐贈的/ usr/bin中/ SFTP錯誤:
/usr/bin/sftp –v -oPort=$SFTP_PORT -b $SFTP_BATCH_FILE [email protected]$REMOTE_SERVER_PROD >> $LOG_FILE 2 >> $LOG_FILE
問候,
柴
爲什麼它是一個「錯誤」使用「if」語句? – Ben
@Ben因爲這是錯誤的事情! –