• Error with ./install.sh

    From RobH@3:770/3 to All on Wed Sep 30 14:02:23 2020
    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

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From alister@3:770/3 to RobH on Wed Sep 30 14:10:39 2020
    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.




    --
    Planet Claire has pink hair.
    All the trees are red.
    No one ever dies there.
    No one has a head....

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ottavio Caruso@3:770/3 to RobH on Wed Sep 30 15:55:58 2020
    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:

    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.




    oops, sorry,

    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?


    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to alister on Wed Sep 30 15:36:53 2020
    On 30/09/2020 15:10, alister 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
    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.




    oops, sorry,

    https://github.com/the-raspberry-pi-guy/lcd/find/master

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to RobH on Wed Sep 30 15:14:13 2020
    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

    I don't see anything wrong with the "read" command. The script is
    displaying a message about rebooting and waiting for a keypress before it
    does the reboot: waiting for a keypress is exactly what "read -n1 -s"
    does. Try running it from a command line: it waits for a keypress and
    then exits.

    Its more likely that there's an unclosed delimiter somewhere in the
    script - a line like

    echo "some text

    will cause the exact same error, but there are a LOT of similar errors
    that can occur in scripts: ' without a closing single quote, [ without a matching ] etc - its quite a common mistake. Similarly, if you supplied a parameter containing some sort of open bracket and the script's author
    didn't enclose that parameter in quotes, that would also cause a similar
    error.


    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Lew Pitcher@3:770/3 to RobH on Wed Sep 30 15:14:16 2020
    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;
    [snip]

    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
    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Wed Sep 30 11:51:13 2020
    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.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Dennis Lee Bieber on Wed Sep 30 17:51:19 2020
    On 30/09/2020 16:51, Dennis Lee Bieber wrote:
    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.



    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.

    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.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Ottavio Caruso on Wed Sep 30 17:36:42 2020
    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:

    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.




    oops, sorry,

    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???

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ottavio Caruso@3:770/3 to RobH on Wed Sep 30 18:00:14 2020
    On 30/09/2020 17:36, RobH wrote:
    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:

    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.




    oops, sorry,

    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???


    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




    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to RobH on Wed Sep 30 18:07:52 2020
    RobH <rob@despammer.com> wrote:
    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.

    Post the output of 'hexdump -C install.sh | tail'
    (install bsdmainutils package if you don't have hexdump)

    My money is that there's a carriage return ('0d' in hexdump) in there
    somewhere - has the file been anywhere near Windows? For example, if it was
    on a file share and opened by a Windows machine.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Lew Pitcher@3:770/3 to RobH on Wed Sep 30 17:15:32 2020
    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,

    ITYM "read -n1 -s"
    (note that the character following the -n is a "digit one" (1) not a
    "lowercase letter L" (l) )

    just hangs, as it waiting for some other command maybe

    No, it's waiting for your input.
    It's the equivalent to "Hit any key to continue", albeit a bit sparse
    (The author could have written
    read -n1 -s -p "Hit any key to continue"
    )

    For the "read" builtin, "One line is read from the standard input".
    The -n1 causes "read" to return after reading 1 character
    The -s causes "read" to not echo the consumed character back to the
    terminal.


    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Martin Gregorie on Wed Sep 30 17:55:12 2020
    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

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Ottavio Caruso on Wed Sep 30 17:29:23 2020
    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.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to RobH on Wed Sep 30 17:48:05 2020
    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.


    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ahem A Rivet's Shot@3:770/3 to RobH on Wed Sep 30 18:39:09 2020
    On Wed, 30 Sep 2020 17:51:19 +0100
    RobH <rob@despammer.com> 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.

    That sounds like an unterminated if/while/ construct in the file or similar. Unexpected end of file is always on the line *after* the last line
    of the file because it reads the final newline as part of the final line
    and then goes to read the next line to finish whatever unfinished construct
    is in progress and reports an error on the line after the last one.

    --
    Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun
    The computer obeys and wins. | licences available see
    You lose and Bill collects. | http://www.sohara.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Lew Pitcher on Wed Sep 30 18:35:24 2020
    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
    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;
    [snip]

    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

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to RobH on Wed Sep 30 20:12:33 2020
    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 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;
    [snip]

    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

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Wed Sep 30 14:23:22 2020
    On Wed, 30 Sep 2020 18:35:24 +0100, RobH <rob@despammer.com> declaimed the following:

    rob@rob-Z97:~/Pi_lcd/lcd-master$ sh -n ./install.sh
    ./install.sh: 34: ./install.sh: Syntax error: end of file unexpected >(expecting "then")

    So it is seeing an incomplete IF construct...


    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

    Now, how about running a DIFF on the two, and showing the result.

    diff instal.sh install.sh


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Dennis Lee Bieber on Wed Sep 30 20:16:25 2020
    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:


    Thanks

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Martin Gregorie on Wed Sep 30 20:20:34 2020
    On 30/09/2020 18:48, Martin Gregorie wrote:
    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.



    Thanks but as I posted lower down, I copied and pasted the 33 lines of
    the script from where I got it from, github, and made a new file called instal.sh.
    Running this completed, but with an error:

    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

    I also posted this lower down.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to RobH on Wed Sep 30 20:37:01 2020
    On 30/09/2020 20:12, RobH wrote:
    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
    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;
    [snip]

    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

    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.

    Again the demo clock.py file runs but not the pi zero.

    Thanks

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to RobH on Wed Sep 30 21:36:21 2020
    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

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From RobH@3:770/3 to Theo on Wed Sep 30 22:56:46 2020
    On 30/09/2020 21:36, Theo wrote:
    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


    All I did was copy and paste the new file instal.sh

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ottavio Caruso@3:770/3 to A. Dumas on Wed Sep 30 23:16:26 2020
    On 30/09/2020 18:29, A. Dumas wrote:
    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.


    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.

    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ahem A Rivet's Shot@3:770/3 to RobH on Thu Oct 1 01:06:38 2020
    On Wed, 30 Sep 2020 22:56:46 +0100
    RobH <rob@despammer.com> wrote:

    All I did was copy and paste the new file instal.sh

    What did you paste it into ?

    --
    Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun
    The computer obeys and wins. | licences available see
    You lose and Bill collects. | http://www.sohara.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Thu Oct 1 01:16:10 2020
    On Wed, 30 Sep 2020 20:37:01 +0100, RobH <rob@despammer.com> declaimed the following:



    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.


    Which is probably the wrong way to "fix" this.

    The most likely reason for the "unary operator" message is that $revision has no value, making the statement

    if [ = "1" ]

    I'm guessing here, but one possible solution is to make the line

    if [ "$revision" = "1" ]

    hence ensuring you have an empty STRING on the left, and not a missing argument. IE:

    if [ "" = "1"]


    The REAL fix is to find out why the variable revision has not been set to a value!


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Thu Oct 1 01:18:06 2020
    On Wed, 30 Sep 2020 20:37:01 +0100, RobH <rob@despammer.com> declaimed the following:


    Addendum to my immediately prior post...


    http://linuxcommand.org/lc3_wss0090.php

    Read the section "Empty Variables"


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Thu Oct 1 00:40:24 2020
    On Wed, 30 Sep 2020 20:16:25 +0100, RobH <rob@despammer.com> declaimed the following:

    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

    Don't know if indentation means anything to the shell, but your top file has a ";" where the second has a ":".

    https://docstore.mik.ua/orelly/unix3/upt/ch28_16.htm
    """
    When the shell sees a semicolon (;) on a command line, it's treated as a command separator -- basically like pressing the ENTER key to execute a command.
    """

    Based upon https://www.geeksforgeeks.org/conditional-statements-shell-script/ the
    "then" is taken as a command (the examples all put it on the line UNDER the "if") so the ";" is likely correct. No idea what the ":" version was doing
    with it... Other than not seeing the "then" as a command.


    32,33c32,33
    < read -n1 -s
    < sudo reboot
    ---
    read -n1 -s:
    sudo reboot:

    And here, both of the lines from the second file have ":" at the end. You seem to have /something/ that seems to have created a lot of ":" where
    they don't belong.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Ottavio Caruso on Thu Oct 1 12:33:46 2020
    On 01-10-2020 00:16, Ottavio Caruso wrote:
    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.

    Dude, he can't even copy-paste, so don't let hem do git.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Chris Elvidge@3:770/3 to RobH on Thu Oct 1 11:43:55 2020
    On 30/09/2020 08:12 pm, RobH wrote:
    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
    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;
    [snip]

    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

    What happens when you run:
    python -c "import RPi.GPIO as GPIO; print GPIO.RPI_REVISION"
    from the command line?
    In install.sh this sets the revision variable.


    --

    Chris Elvidge, England

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Dennis Lee Bieber on Thu Oct 1 12:34:53 2020
    On 01-10-2020 06:40, Dennis Lee Bieber wrote:
    Don't know if indentation means anything to the shell,

    Then why the hell are you posting in this thread?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Scott Alfter@3:770/3 to rob@despammer.com on Tue Oct 6 17:06:32 2020
    In article <htjrc7F1intU1@mid.individual.net>, RobH <rob@despammer.com> wrote:
    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.

    Why are you copying and pasting instead of downloading? Depending on the
    copy source, you're possibly adding extra newlines that you don't know
    about. (I know that copying from the output of more will do that, while copying from the output of cat won't.) Just run this:

    wget https://raw.githubusercontent.com/the-raspberry-pi-guy/lcd/master/install.sh

    _/_
    / v \ Scott Alfter (remove the obvious to send mail)
    (IIGS( https://alfter.us/ Top-posting!
    \_^_/ >What's the most annoying thing on Usenet?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)