Trying to run this code (using 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
Getting the following Errors:
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
CodePudding user response:
If you want the script to be executed by bash
as the shebang line dictates then do
chmod x write_eeprom.sh
./write_eeprom.sh
Recommendation: you don't need the .sh
extension, you can rename it as just write_eeprom
and use https://www.shellcheck.net/ to check your script