I had to do a reinstall of my linux system due to a faulty ssd, and have
a problem with a install.sh script.The said script is included in with
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
These are the last 4 lines in the script, and if I count the spaces
then:
echo "Should be now all finished. Please press any key to now reboot.
After rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s <<<<<<<<<<<<<<<<<<<<< I think this is the line in question
sudo reboot
Thanks
On 30/09/2020 15:10, alister wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:oops, sorry,
I had to do a reinstall of my linux system due to a faulty ssd, and have >>> a problem with a install.sh script.The said script is included in with
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
These are the last 4 lines in the script, and if I count the spaces
then:
echo "Should be now all finished. Please press any key to now reboot.
After rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s <<<<<<<<<<<<<<<<<<<<< I think this is the line in question
sudo reboot
Thanks
if you could detail which github download you are using it may help
someone to answer your question.
https://github.com/the-raspberry-pi-guy/lcd/find/master
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
I had to do a reinstall of my linux system due to a faulty ssd, and have
a problem with a install.sh script.The said script is included in with
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
These are the last 4 lines in the script, and if I count the spaces
then:
echo "Should be now all finished. Please press any key to now reboot.
After rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s <<<<<<<<<<<<<<<<<<<<< I think this is the line in question
sudo reboot
Thanks
if you could detail which github download you are using it may help
someone to answer your question.
I had to do a reinstall of my linux system due to a faulty ssd, and have
a problem with a install.sh script.The said script is included in with
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
These are the last 4 lines in the script, and if I count the spaces
then:
echo "Should be now all finished. Please press any key to now reboot.
After rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s <<<<<<<<<<<<<<<<<<<<< I think this is the line in question
sudo reboot
Thanks
I had to do a reinstall of my linux system due to a faulty ssd, and have[snip]
a problem with a install.sh script.The said script is included in with
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
On 30/09/2020 15:10, alister wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
if you could detail which github download you are using it may help
someone to answer your question.
oops, sorry,
https://github.com/the-raspberry-pi-guy/lcd/find/master
On Wed, 30 Sep 2020 15:36:53 +0100, RobH <rob@despammer.com> declaimed the following:
On 30/09/2020 15:10, alister wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
if you could detail which github download you are using it may help
someone to answer your question.
oops, sorry,
https://github.com/the-raspberry-pi-guy/lcd/find/master
Well -- since there are only 33 lines IN that file... I'd propose that you have some noise line (not line noise) in your copy. An EOF character,
or wrong line ending.
https://github.com/the-raspberry-pi-guy/lcd/blob/master/install.sh
If you have an editor that shows non-printable characters (hexdump?) see if there is something that doesn't correlate to the visible text.
On 30/09/2020 15:36, RobH wrote:
On 30/09/2020 15:10, alister wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:oops, sorry,
I had to do a reinstall of my linux system due to a faulty ssd, and
have
a problem with a install.sh script.The said script is included in with >>>> lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an >>>> lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
These are the last 4 lines in the script, and if I count the spaces
then:
echo "Should be now all finished. Please press any key to now reboot.
After rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s <<<<<<<<<<<<<<<<<<<<< I think this is the line in question >>>> sudo reboot
Thanks
if you could detail which github download you are using it may help
someone to answer your question.
https://github.com/the-raspberry-pi-guy/lcd/find/master
There's no line 34. Maybe the file is corrupted. How did you download
the script? Did you use git?
On 30/09/2020 15:55, Ottavio Caruso wrote:
On 30/09/2020 15:36, RobH wrote:
On 30/09/2020 15:10, alister wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:oops, sorry,
I had to do a reinstall of my linux system due to a faulty ssd, and
have
a problem with a install.sh script.The said script is included in with >>>>> lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an >>>>> lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
These are the last 4 lines in the script, and if I count the spaces
then:
echo "Should be now all finished. Please press any key to now reboot. >>>>> After rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s <<<<<<<<<<<<<<<<<<<<< I think this is the line in question >>>>> sudo reboot
Thanks
if you could detail which github download you are using it may help
someone to answer your question.
https://github.com/the-raspberry-pi-guy/lcd/find/master
There's no line 34. Maybe the file is corrupted. How did you download
the script? Did you use git?
I just downloaded the files from Github, using a download button, but
that is not there now???
Yes you are correct in that there is only 33 lines in that file.
I don't have an editor which shows non-printable characters.
On 30/09/2020 16:14, Martin Gregorie wrote:
read -n1 -s
Running the read -nl -s in a terminal,
just hangs, as it waiting for some other command maybe
read -n1 -s
On 30/09/2020 17:36, RobH wrote:
I just downloaded the files from Github, using a download button, but
that is not there now???
That's not how you do it. You either checkout from Github:
git clone https://github.com/the-raspberry-pi-guy/lcd.git
or download the tarball and extract it: https://github.com/the-raspberry-pi-guy/lcd/archive/master.zip
On 30/09/2020 16:14, Martin Gregorie wrote:
read -n1 -s
Running the read -nl -s in a terminal, just hangs, as it waiting for
some other command maybe
Even after copying and pasting the 33 line script from your link, it
still gives the same error message for line 34:
./install.sh: line 34: syntax error: unexpected end of file.
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
I had to do a reinstall of my linux system due to a faulty ssd, and have[snip]
a problem with a install.sh script.The said script is included in with
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
As others have suggested, the contents and origin of your install.sh
script are in question. The best choice is to follow up on that, and
obtain a valid install.sh script.
Failing that, you might try more diagnosis on the current install.sh
script. You might try some simple shell debugging techniques:
1) Use the shell to interpret, but not execute, the script by turning on
the -n shell option. This will syntax-check the script without allowing
it to perform any operations.
For example:
sh -n ./install.sh
2) Use the shell to execute the script while displaying the unexpanded
shell commands to stdout, by turning on the -v option. This permits
you to see exactly the script lines as they are read.
For example:
sh -v ./install.sh
3) Use the shell to execute the script while displaying the expanded
shell commands to stdout, by turning on the -x option. This permits
you to see the exact content of the executed lines.
For example:
sh -x ./install.sh
Note: the -n, -v and -x option may not be available in all shell interpreters. If install.sh is a POSIX shell script, you may execute it
with bash, which does support these options.
HTH
On 30/09/2020 16:14, Lew Pitcher wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
I had to do a reinstall of my linux system due to a faulty ssd, and have >>> a problem with a install.sh script.The said script is included in with[snip]
lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an
lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
As others have suggested, the contents and origin of your install.sh
script are in question. The best choice is to follow up on that, and
obtain a valid install.sh script.
Failing that, you might try more diagnosis on the current install.sh
script. You might try some simple shell debugging techniques:
1) Use the shell to interpret, but not execute, the script by turning on
the -n shell option. This will syntax-check the script without
allowing
it to perform any operations.
For example:
sh -n ./install.sh
2) Use the shell to execute the script while displaying the unexpanded
shell commands to stdout, by turning on the -v option. This permits >> you to see exactly the script lines as they are read.
For example:
sh -v ./install.sh
3) Use the shell to execute the script while displaying the expanded
shell commands to stdout, by turning on the -x option. This permits >> you to see the exact content of the executed lines.
For example:
sh -x ./install.sh
Note: the -n, -v and -x option may not be available in all shell
interpreters. If install.sh is a POSIX shell script, you may execute it
with bash, which does support these options.
HTH
Running the above commands :
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected (expecting "then")
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected (expecting "then")
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -x ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected (expecting "then")
So as there are only 33 lines in the script, would the line 34 be
hidden or something with the word "then"
Update:
I copied and pasted the 33 lines into a new file and named it instal.sh,
then ran it.
Result:no errors apart from this one during the install process:
ImportError: No module named RPi.GPIO
./instal.sh: line 15: [: =: unary operator expected
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected >(expecting "then")
Update:
I copied and pasted the 33 lines into a new file and named it instal.sh,
then ran it.
Result:no errors apart from this one during the install process:
ImportError: No module named RPi.GPIO
./instal.sh: line 15: [: =: unary operator expected
diff instal.sh install.sh
if [ "$(id -u)" != "0" ]: then32,33c32,33
echo "Please re-run as sudo."
exit 1
read -n1 -s:
sudo reboot:
On Wed, 30 Sep 2020 17:55:12 +0100, RobH wrote:
On 30/09/2020 16:14, Martin Gregorie wrote:
read -n1 -s
Running the read -nl -s in a terminal, just hangs, as it waiting for
some other command maybe
NO! as I said, its asking for you to press any key. Read its manpage
$ man read
shows you the bash manual search down for the 'read' builtin command.
This will tell you that:
- 'read' defaults to reading from stdin, which is connected to the
terminal when you run it from the terminal)
- that the -n option says how many characters it should read
(so -n1 will read one character)
- that the -s option tells it not to echo its input
In other words, you saw 'read' doing exactly what you asked: to wait for
one keystroke and silently exit when you hit a key.
Try running this script:
===========demo script starts on the next line ===================
#! /bin/bash
#
echo "Hit any key to continue"
read -n1 -s
echo "Continuing..."
===========demo script ends on the previous line ===================
save these 5 lines as a file called 'demo',
make it executable ('chmod u+x demo')
and run it. Now it may be clearer that 'read' is not your problem.
You should also get used to using the 'man' and 'apropos' commands.
'man' describes how to use every command (and every function in the C standard library....) and 'apropos' searches for commands, functions, etc that match your search term, so the command 'apropos file' lists all the commands that work with files.
On 30/09/2020 18:35, RobH wrote:
On 30/09/2020 16:14, Lew Pitcher wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
I had to do a reinstall of my linux system due to a faulty ssd, and[snip]
have
a problem with a install.sh script.The said script is included in with >>>> lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an >>>> lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
As others have suggested, the contents and origin of your install.sh
script are in question. The best choice is to follow up on that, and
obtain a valid install.sh script.
Failing that, you might try more diagnosis on the current install.sh
script. You might try some simple shell debugging techniques:
1) Use the shell to interpret, but not execute, the script by turning on >>> the -n shell option. This will syntax-check the script without
allowing
it to perform any operations.
For example:
sh -n ./install.sh
2) Use the shell to execute the script while displaying the unexpanded
shell commands to stdout, by turning on the -v option. This permits >>> you to see exactly the script lines as they are read.
For example:
sh -v ./install.sh
3) Use the shell to execute the script while displaying the expanded
shell commands to stdout, by turning on the -x option. This permits >>> you to see the exact content of the executed lines.
For example:
sh -x ./install.sh
Note: the -n, -v and -x option may not be available in all shell
interpreters. If install.sh is a POSIX shell script, you may execute it
with bash, which does support these options.
HTH
Running the above commands :
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected
(expecting "then")
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected
(expecting "then")
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -x ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected
(expecting "then")
So as there are only 33 lines in the script, would the line 34 be
hidden or something with the word "then"
Update:
I copied and pasted the 33 lines into a new file and named it
instal.sh, then ran it.
Result:no errors apart from this one during the install process:
ImportError: No module named RPi.GPIO
./instal.sh: line 15: [: =: unary operator expected
I have installed RPi.GPIO by:
pip install RPi.GPIO and ran the install script again, but get this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File
"/home/rob/.local/lib/python2.7/site-packages/RPi/GPIO/__init__.py",
line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
./instal.sh: line 15: [: =: unary operator expected
I2C Pins detected as 1
I2C Library setup for this revision of Raspberry Pi, if you change
revision a modification will be required to i2c_lib.py
Now overwriting modules & blacklist. This will enable i2c Pins
Should be now all finished. Please press any key to now reboot. After rebooting run
'sudo python demo_lcd.py' from this directory
I am trying to get this to work or run on a Pi Zero with a 16x2 lcd
screen, and although the python demo_lcd.py script runs but for some
reason it isn't activating the lcd screen
On 30/09/2020 19:23, Dennis Lee Bieber wrote:
diff instal.sh install.sh
Output as requested:
rob@rob-Z97:~/Pi_lcd/lcd-master$ diff instal.sh install.sh
2,4c2,4
< if [ "$(id -u)" != "0" ]; then
< echo "Please re-run as sudo."
< exit 1
---
if [ "$(id -u)" != "0" ]: then32,33c32,33
echo "Please re-run as sudo."
exit 1
< read -n1 -s
< sudo reboot
---
read -n1 -s:
sudo reboot:
RobH <rob@despammer.com> wrote:
On 30/09/2020 19:23, Dennis Lee Bieber wrote:
diff instal.sh install.sh
Output as requested:
rob@rob-Z97:~/Pi_lcd/lcd-master$ diff instal.sh install.sh
2,4c2,4
< if [ "$(id -u)" != "0" ]; then
< echo "Please re-run as sudo."
< exit 1
---
> if [ "$(id -u)" != "0" ]: then
> echo "Please re-run as sudo."
> exit 1
32,33c32,33
< read -n1 -s
< sudo reboot
---
> read -n1 -s:
> sudo reboot:
You seem to be having spurious colons there, and a semicolon turning into a colon. Is there something about the way you're creating the file?
Theo
Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
On 30/09/2020 17:36, RobH wrote:
I just downloaded the files from Github, using a download button, but
that is not there now???
That's not how you do it. You either checkout from Github:
git clone https://github.com/the-raspberry-pi-guy/lcd.git
or download the tarball and extract it:
https://github.com/the-raspberry-pi-guy/lcd/archive/master.zip
No. If you want just a single file and you don't know about git, definitely don't try that. Click the "Raw" button and save the output of that. Either via copy/paste from the browser or using wget from the terminal with the
URL of that raw file.
All I did was copy and paste the new file instal.sh
I managed to get rid of the error at line 15:
if [ $revision = "1" ]
by changing it to this:
if [ $revision: = "1" ]
so no unary operator error now.
On 30/09/2020 19:23, Dennis Lee Bieber wrote:
diff instal.sh install.sh
Output as requested:
rob@rob-Z97:~/Pi_lcd/lcd-master$ diff instal.sh install.sh
2,4c2,4
< if [ "$(id -u)" != "0" ]; then
< echo "Please re-run as sudo."
< exit 1
---
if [ "$(id -u)" != "0" ]: then
echo "Please re-run as sudo."
exit 1
32,33c32,33
< read -n1 -s
< sudo reboot
---
read -n1 -s:
sudo reboot:
On 30/09/2020 18:29, A. Dumas wrote:
Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
That's not how you do it. You either checkout from Github:
git clone https://github.com/the-raspberry-pi-guy/lcd.git
or download the tarball and extract it:
https://github.com/the-raspberry-pi-guy/lcd/archive/master.zip
No. If you want just a single file and you don't know about git,
definitely
don't try that. Click the "Raw" button and save the output of that.
Either
via copy/paste from the browser or using wget from the terminal with the
URL of that raw file.
And why not? This is the canonical way of getting files from git. A lot
of things can go wrong just by copying the raw file.
On 30/09/2020 18:35, RobH wrote:
On 30/09/2020 16:14, Lew Pitcher wrote:
On Wed, 30 Sep 2020 14:02:23 +0100, RobH wrote:
I had to do a reinstall of my linux system due to a faulty ssd, and[snip]
have
a problem with a install.sh script.The said script is included in with >>>> lcd files. which I downloaded from github.
It is a simple script which runs a realtime clock on a pi zero with an >>>> lcd screen.
When I run ./install.sh, it fails at ./install.sh: line 34: syntax
error: unexpected end of file.
I don't know what the syntax should be here;
As others have suggested, the contents and origin of your install.sh
script are in question. The best choice is to follow up on that, and
obtain a valid install.sh script.
Failing that, you might try more diagnosis on the current install.sh
script. You might try some simple shell debugging techniques:
1) Use the shell to interpret, but not execute, the script by turning on >>> the -n shell option. This will syntax-check the script without
allowing
it to perform any operations.
For example:
sh -n ./install.sh
2) Use the shell to execute the script while displaying the unexpanded
shell commands to stdout, by turning on the -v option. This permits
you to see exactly the script lines as they are read.
For example:
sh -v ./install.sh
3) Use the shell to execute the script while displaying the expanded
shell commands to stdout, by turning on the -x option. This permits
you to see the exact content of the executed lines.
For example:
sh -x ./install.sh
Note: the -n, -v and -x option may not be available in all shell
interpreters. If install.sh is a POSIX shell script, you may execute it
with bash, which does support these options.
HTH
Running the above commands :
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected
(expecting "then")
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected
(expecting "then")
rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -x ./install.sh
./install.sh: 34: ./install.sh: Syntax error: end of file unexpected
(expecting "then")
So as there are only 33 lines in the script, would the line 34 be
hidden or something with the word "then"
Update:
I copied and pasted the 33 lines into a new file and named it
instal.sh, then ran it.
Result:no errors apart from this one during the install process:
ImportError: No module named RPi.GPIO
./instal.sh: line 15: [: =: unary operator expected
I have installed RPi.GPIO by:
pip install RPi.GPIO and ran the install script again, but get this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File
"/home/rob/.local/lib/python2.7/site-packages/RPi/GPIO/__init__.py",
line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
../instal.sh: line 15: [: =: unary operator expected
I2C Pins detected as 1
I2C Library setup for this revision of Raspberry Pi, if you change
revision a modification will be required to i2c_lib.py
Now overwriting modules & blacklist. This will enable i2c Pins
Should be now all finished. Please press any key to now reboot. After rebooting run
'sudo python demo_lcd.py' from this directory
I am trying to get this to work or run on a Pi Zero with a 16x2 lcd
screen, and although the python demo_lcd.py script runs but for some
reason it isn't activating the lcd screen
Don't know if indentation means anything to the shell,
On 30/09/2020 16:51, Dennis Lee Bieber wrote:
Even after copying and pasting the 33 line script from your link, it
still gives the same error message for line 34:
./install.sh: line 34: syntax error: unexpected end of file.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 53:55:56 |
Calls: | 6,650 |
Calls today: | 2 |
Files: | 12,200 |
Messages: | 5,330,612 |