我在脚本中具有以下命令集:
message="Secure copying file $remoteHost"
backupLogOutput "Info $message"
$(scp "$file" "$remoteUser"@"$remoteHost":"$remotePath") >> "$BACKUPLOG"
backupErrorHandler "$?" "$message"
ShellCheck在SCP线(3)上给我警告:
删除周围的$()以避免执行输出。[SC2091]
脚本有效。我确实想执行输出。我应该忽略此警告还是应该以不同的方式写入SCP线?
我认为您实际上不想执行scp
输出 - 看起来更像您只想复制一个文件:
scp "$file" "$remoteUser"@"$remoteHost":"$remotePath" >> "$BACKUPLOG"