gpt4 book ai didi

bash - ShellCheck 警告 : "Remove surrounding $() to avoid executing output. [SC2091]"

转载 作者:行者123 更新时间:2023-12-05 02:17:30 25 4
gpt4 key购买 nike

我的脚本中有以下命令集:

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"

关于bash - ShellCheck 警告 : "Remove surrounding $() to avoid executing output. [SC2091]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47677612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com