Results 1 to 4 of 4
  1. skymann's Avatar
    Posts
    14 Posts
    Global Posts
    15 Global Posts
       #1  
    I am trying to make a script, named "sing", that will ping, sleep for a while, ping, sleep for ....

    I have tried the one below with no joy.

    while true; do
    sleep 5
    ping -c 1 8.8.8.8
    done

    I get an error>> sing: line 6: syntax error: unexpected end of line (expecting "do")

    The sleep 5, ping works but I need it to loop. My scripting for the TP is not very good. How can this be done? Please give it a try on your TP as I have tried many things and searched for several hours.

    I also tried to loop script calls but no joy there either.
  2. skymann's Avatar
    Posts
    14 Posts
    Global Posts
    15 Global Posts
       #2  
    doesn't anyone know how to write a script for the wonderful touchpad? Evidently I don't but someone should
  3. vreihen's Avatar
    Posts
    495 Posts
    Global Posts
    506 Global Posts
    #3  
    Quote Originally Posted by skymann View Post
    doesn't anyone know how to write a script for the wonderful touchpad? Evidently I don't but someone should
    The syntax that you have posted is 100% correct per the /bin/sh Busybox on my TP under xterm. My guess is that you used a PC text editor to create the file, and have MS-DOS line breaks <CR><LF> instead of Unix/Linux <LF> at the end of each line.

    The only other thing that it could be is the wrong shell being loaded, which you can prevent by including the following line verbatim as the first line of the file:

    #!/bin/sh
    while true
    do
    sleep 5
    ping -c 1 8.8.8.8
    done

    It tells the current shell which shell to load to run your script.....
    Sent from my Etch-a-Sketch.

    #staycoolmybabies
  4. skymann's Avatar
    Posts
    14 Posts
    Global Posts
    15 Global Posts
       #4  
    Thanks for the reply. The problem was exactly the "\r" created in internalz editor. It made me search for the editor problem which was mentioned here: http://forums.precentral.net/3207813-post7.html

    It should would be better to have all the necessary editing key easily available on the TP so I could use vi.

Posting Permissions