Trying a simple test to light a led from a bash script file I get this error:

./led.sh: línea 2: source: /usr/bin/gpio: no se puede ejecutar el fichero binario

Translated from spanish: "cannot execute binary file".

This is the bash file led.sh:

source gpio
gpio mode 14 out
while true; do
gpio write 14 1
sleep 1.3
gpio write 14 0
sleep 1.3

I've intalled gpio with:

sudo apt-get install wiringpi

file /usr/bin/gpio returns:

/usr/bin/gpio: setuid ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32,
BuildID[sha1]=7bc6d47c77e1363ba691fb0b176c162c5e2b3597, not stripped

gpio -v returns:

gpio version: 2.32
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Sony 
  * Device tree is enabled.
  * This Raspberry Pi supports user-level GPIO access.
     -> See the man-page for more details
     -> ie. export WIRINGPI_GPIOMEM=1

How can I get this script running?

2 Answers 2


Your script includes source gpio; I am unsure what you are attempting to do here, but this seems inappropriate. This is normally used to execute external commands.

NOTE the gpio installed from the Raspbian repositories is out of date. You can compile and install gpio version: 2.36

  • I copied the example so I don't really know what is this line for. I've tested deleting this line and I have no any error but led doesn't light. Commented Feb 7, 2017 at 8:36
  • You should include a link to the source (in your question), but without details of your wiring (which implies physical pin 23) no comment is possible.
    – Milliways
    Commented Feb 7, 2017 at 8:55
  • source executes the contents of a file assuming they are a list of (text) shell commands. A binary will confuse the command.
    – joan
    Commented Feb 7, 2017 at 9:22
  • The original example was wrong in many aspects (or was older than I thought). It's not necesary the line source gpio, and the numbers that identify GPIO connectors are not the same using gpio than those used with /sys/class/gpio. Commented Feb 8, 2017 at 9:45

As Milliways said source gpio line is not appropite.

On the other hand, the example used BCM numbering schema but it must use WiringPi numbering schema instead (or add -g parameter). So the script now is (due to 14 in BCM schema corresponds to 15 in WiringPi schema.):

gpio mode 15 out
while true; do
gpio write 15 1
sleep 1.3
gpio write 15 0
sleep 1.3


gpio -g mode 14 out
while true; do
gpio -g write 14 1
sleep 1.3
gpio -g write 14 0
sleep 1.3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.