ShellCheck 警告:"Remove surrounding $() to avoid executing output. [SC2091]"
ShellCheck warning: "Remove surrounding $() to avoid executing output. [SC2091]"
我的脚本中有以下命令集:
message="Secure copying file $remoteHost"
backupLogOutput "Info $message"
$(scp "$file" "$remoteUser"@"$remoteHost":"$remotePath") >> "$BACKUPLOG"
backupErrorHandler "$?" "$message"
ShellCheck 在 scp 行 (3) 上给我警告:
Remove surrounding $() to avoid executing output. [SC2091]
脚本有效。我确实想执行输出。我应该忽略这个警告还是应该以不同的方式编写 scp 行?
我认为您实际上并不想执行 scp
输出 - 它看起来更像是您只是想复制一个文件:
scp "$file" "$remoteUser"@"$remoteHost":"$remotePath" >> "$BACKUPLOG"
我的脚本中有以下命令集:
message="Secure copying file $remoteHost"
backupLogOutput "Info $message"
$(scp "$file" "$remoteUser"@"$remoteHost":"$remotePath") >> "$BACKUPLOG"
backupErrorHandler "$?" "$message"
ShellCheck 在 scp 行 (3) 上给我警告:
Remove surrounding $() to avoid executing output. [SC2091]
脚本有效。我确实想执行输出。我应该忽略这个警告还是应该以不同的方式编写 scp 行?
我认为您实际上并不想执行 scp
输出 - 它看起来更像是您只是想复制一个文件:
scp "$file" "$remoteUser"@"$remoteHost":"$remotePath" >> "$BACKUPLOG"