They didn't indicate to run that. They said:
sudo ./LCD35C-show
The sudo
part means that it needs to run as the root
user temporarily. You should have been prompted for the pi
user's password to credential for that.
That said, the script file itself is missing the typical "shebang" at the top that tells your default shell how it needs to be run.
As an example, here is a script I have created in ~/scripts
called killhmi
:
#!/bin/bash
PYTHONID="$(ps -ax -o pid,command | grep /home/pi/ocm-hmi/__init__.py | grep python | awk '{print $1}')"
if test -z "$PYTHONID"
then
echo "Nothing found to kill"
else
/bin/kill -9 $PYTHONID
fi
The first line is a shebang and tells my remote bash
shell that I want this to run in another bash
shell during its execution.
The danger of not including that first line is that the script author assumes that everyone else has the same shell that they do. There are several different shells and different operating systems and they have slightly different syntax.
Additionally, your script has goodies like this nestled inside it:
sudo apt-get install xserver-xorg-input-evdev
...in addition to other code which assumes that you're running the Desktop version of Raspbian. In my humble opinion, I don't love scripts and manufacturers like this (at all). Compare and contrast with the Adafruit version. Here are the top several lines:
#!/bin/bash
# (C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
#
# Instructions!
# cd ~
# wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
# chmod +x adafruit-pitft.sh
# sudo ./adafruit-pitft.sh
if [ $(id -u) -ne 0 ]; then
echo "Installer must be run as root."
echo "Try 'sudo bash $0'"
exit 1
fi
Not only does she include the shebang, pedigree and instructions but she's also coded it so that it will be gentle if you haven't run this with sudo
, as instructed. Later in the script is a usage section and it will tell you what's going on and ask you before performing steps.