【发布时间】:2022-12-22 03:23:22
【问题描述】:
尝试运行此代码(使用 sh write_eeprom.sh )
#!/bin/bash
testdesc=$1
qr_heisys=$2
if [[ $testdesc == "-h" ]]
then
echo "script to write data to Board EEPROM of Heisys"
echo "eeprom is at address 0x55"
echo "first argument is testdesc"
echo "second argument is qr"
echo "usage: write_eeprom.sh "write to eeprom" "$qr_heisys""
exit 0
fi
teststep "${testdesc}"
echo "qr_heisys = "$qr_heisys
${testpath}${script}qr2eeprom.py "$qr_heisys"
if [[ $? -ne "0" ]]
then
fail "Error writing QR Code to eeprom"
else
printlog "Write QR to Boardeeprom was succesfull PASS"
fi
出现以下错误:
write_eeprom.sh: 6: [[: not found
write_eeprom.sh: 16: teststep: not found
qr_heisys =
write_eeprom.sh: 20: qr2eeprom.py: not found
write_eeprom.sh: 22: [[: not found
write_eeprom.sh: 26: printlog: not found
【问题讨论】:
-
确定您使用的是 bash 吗?我打赌你不是。
-
所以我正在使用“sh write_eeprom.sh”来运行代码。如果可以,您能告诉我如何确定这不是 bash 吗?
-
sh 不是 bash,它是 sh,并且没有 bash 的许多功能。
-
哦好的!我需要将#!/bin/bash 更改为“#!/bin/sh”吗?我怎么能或如何解决这些错误?我也使用 export PATH 来给出路径
标签: bash shell ubuntu-20.04