我正在编写简单的 shell 脚本,当我在https://www.shellcheck.net检查我的脚本时,它在第 14 行出现错误
Line 14:
sysrc ifconfig_"${Bridge}"="addm ${NIC}"
^-- SC2140: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
Run Code Online (Sandbox Code Playgroud)
https://github.com/koalaman/shellcheck/wiki/SC2140
事实上我不明白如何纠正它
#!/bin/sh
Setup() {
# Determine interface automatically
NIC="$(ifconfig -l | awk '{print $1}')"
# Enabling the Bridge
Bridge="$(ifconfig bridge create)"
# Next, add the local interface as member of the bridge.
# for the bridge to forward packets,
# all member interfaces and the bridge need to be up:
ifconfig …Run Code Online (Sandbox Code Playgroud)