I am working on a project and have an application shell script. For function part, I need the GPIO access, and for that, I am using the standard wiringpi package.
The issue I am getting is with the #!/bin/bash
vs #!/bin/sh
use
I have been using the #!/bin/bash
in past in conjunction with the wiringpi function - Raspberry Pi A+
but now when I have switched to the Raspberry Pi Jessie buster July 2019, I am having an issue running the wiring Pi function
for example
gpio mode 21 out
gpio -g write 21 0
working fine inside script if I use #!/bin/sh
but I get warnings for the associative array
Warning:
./dataLog.sh: 292: ./dataLog.sh: declare: not found
./dataLog.sh: 295: ./dataLog.sh: Bad substitution
Code:
Line 291: declare -A status="($(upsc myups | sed 's/\(.*\):\(.*\)/[\1]="\2"/'))"
Line 295: if [[ ${status[device.model]} != "" ]] ; then
if I use the #!/bin/bash
, I do not get any error related to the associative array, but now my GPIO is not working.
I am trying to find the solution to the issue - Where I can use #!/bin/bash shell and wiringpi functions together
Thank you
gpio
not working in one version. Which is a real mystery.