我正在尝试将 .py 文件写入 write_eeprom.sh。我收到错误 'Not Found'

I am trying to wirte a .py file into the write_eeprom.sh. I am getting the error 'Not Found'

正在尝试 运行 此代码(使用 sh write_eeprom.sh

#!/bin/bash                                                                                                                                                                                                

testdesc=
qr_heisys=

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

如果您希望脚本按照 shebang 行的指示由 bash 执行,那么请执行

chmod +x write_eeprom.sh
./write_eeprom.sh

建议:您不需要 .sh 扩展名,您可以将其重命名为 write_eeprom 并使用 https://www.shellcheck.net/ 检查您的脚本