【发布时间】:2020-12-07 05:10:24
【问题描述】:
我正在尝试检查我的以太网适配器是否是硬连线的。为此,我的代码中有以下部分:
if 'ifconfig | grep "status: active" | head -2 | tail -1 | awk {'print$2'} | cut -f1 -d:'; then
wired_status=True
echo $wired_status
对于这部分代码,它给出了以下错误:
./tst_wired.sh:第 27 行:ifconfig | grep "状态:活动" |头-2 |尾-1 | awk {打印} | cut -f1 -d:: 找不到命令
在我的终端中键入“ifconfig”会被识别并有效。
【问题讨论】:
-
谢谢。我也试过了,认为这就是问题所在。但是,将其更改为反引号会产生相同的错误。