Results 1 to 19 of 19
  1.    #1  
    I am trying to install and run a Shell Script to Mount and Unmount USB mass storage drives on the TouchPad MicroUSB port in OTG Mode.

    The First line in the Script file (named mountusb) is
    #!/bin/sh

    I have placed the Script file in the /usr/bin and checked that /usr/bin is in Path.

    From Iterm, I have set:
    chmod a+x /usr/bin/mountusb

    From Iterm:
    root@HPTouchpad:/var/home/root# mountusb ...returns
    -sh: mountusb not found

    Any suggestions?

    Lastly, How can I set up an Icon on the GUI to run the Script?
  2. #2  
    Might be a path issue; even if its in your directory use ./mountusb. If you want to run it from an icon you'll want to use the full path /var/home/root/mountusb .

    I don't know about the icon.
  3. #3  
    I've never run a shell script on the touchpad, but it looks like your current directory is not set in your PATH. Try adding the current directory "./" as part of the command, like this:

    root@HPTouchpad:/var/home/root# ./mountusb
  4.    #4  
    Thanks bdbr and mattman5000. I tried your suggestion of ./mountusb but it also returned
    -sh: ./mountusb: not found

    The script file mountusb is in /usr/bin/ and /usr/bin/ is in the Path.

    I also tried: root@HPTouchpad:/var/home/root# /usr/bin/mountusb with the same result.

    I also created a simple script file called testsc in /usr/bin/ with just three lines:
    #!/bin/sh
    echo "Hello world"
    exit

    Got the same result:
    -sh: testsc: not found

    Any other thoughts?
  5. #5  
    Quote Originally Posted by Wheel_nut View Post
    -sh: testsc: not found
    You may also get that type of error when the file doesn't have a Unix-type line endings.
  6.    #6  
    Quote Originally Posted by mimoo View Post
    You may also get that type of error when the file doesn't have a Unix-type line endings.
    Mimoo, Could you explain what you mean and how I might rectify it.

    The testsc script was created on the TouchPad using the editor in Initialz.
  7. #7  
    Quote Originally Posted by Wheel_nut View Post
    Mimoo, Could you explain what you mean and how I might rectify it.

    The testsc script was created on the TouchPad using the editor in Initialz.
    A Unix line-ending uses just "\n" to indicate a new line. DOS line endings (which is maybe what is being used by the text editor), uses "\r\n". The extra "\r" may be seen as part of "/bin/sh\r" (which doesn't exist).

    You can check with:

    hexdump -c script

    If you see "\r" then it's the problem.

    Try stripping the extra "\r" with:

    tr -d "\r" < oldscript > newscript

    Then the usual to run it:

    chmod +x newscript
    ./newscript
    Last edited by mimoo; 10/15/2011 at 09:11 AM.
  8.    #8  
    Sorry, I should have said "Internalz" ...

    The problem is that if you edit a Script file using the Internalz Editor, it will prevent the Script running. I don't know whetherit is because of the Cr/ Lf difference between UNIX and Windows but here's how I fixed it:

    I put the Script file on a USB Key and transferred it to my UBUNTU ThinkPad. There is a Linux package called dos2unix which provides two utlities. I used unix2dos to convert it to a DOS Text file and then used dos2unix to convert it back. When transferred back to the TouchPad, it ran.

    There was another issue. The TouchPad only provides sh and not bash. I didn't realise that the "Function" command was different so ran 'round in circles until I realised the problem and changed all of the [function function_name] lines to [function_name()]

    I now have working mountusb and dismountusb scripts, each accepting two arguments for the Device and destination Directory but defaulting to sda1 and usb1.

    Thank you for the pointers....
    Last edited by Wheel_nut; 10/15/2011 at 08:42 PM.
  9. #9  
    There's a reason I prefer raw text editors. Just need one for the TP. :-(

    -- Sent from my HP TouchPad using Communities
  10. #10  
    I use vi when I edit files and create shell scripts on the TP....
  11.    #11  
    Quote Originally Posted by jblather View Post
    I use vi when I edit files and create shell scripts on the TP....
    Hi jblather

    What is vi and where can I get it?
  12. #12  
    I am trying to install and run a Shell Script to Mount and Unmount USB mass storage drives on the TouchPad MicroUSB port in OTG Mode.

    The First line in the Script file (named mountusb) is
    #!/bin/sh

    I have placed the Script file in the /usr/bin and checked that /usr/bin is in Path.

    From Iterm, I have set:
    chmod a+x /usr/bin/mountusb

    From Iterm:
    root@HPTouchpad:/var/home/root# mountusb ...returns
    -sh: mountusb not found

    Any suggestions?

    Lastly, How can I set up an Icon on the GUI to run the Script?
    Have a read of this thread:

    http://forums.precentral.net/nelsun-...ve-mapper.html

    then PM Norf as he has done this already albeit for network shares - he may be able to give you a steer :-)
  13. #13  
    You can do so with a homebrew jsjsjs $service$ $and$ $a$ $frontend$ $app$.

    For an example, my SysToolsMgr code is MIT open source at https://code.google.com/p/systoolsmgr-service/
    If you've liked my software, please consider to towards future development.

    Developer of many apps such as: WebOS Quick Install, WebOS Theme Builder, Ipk Packager, Unified Diff Creator, Internalz Pro, ComicShelf HD, LED Torch, over 70 patches and more.

    @JayCanuck @CanuckCoding Facebook
  14. #14  
    Quote Originally Posted by Wheel_nut View Post
    Hi jblather

    What is vi and where can I get it?
    Vi is a well-known, long-established, and very-loved editor. Its history dates back to the days of UNIX.

    It's shipped on every TouchPad.

    Here's what I found when I Googled for "vi editor". Here are the first two of the many results that resulted:

    vi - Wikipedia, the free encyclopedia
    Mastering the VI editor
  15. pml
    pml is offline
    pml's Avatar
    Posts
    47 Posts
    #15  

    regarding vi:

    How do you enter the Esc key, which vi makes use of by design?
    Which Terminal do you use? Xterm, I suppose!?
    I didn't find a way to enter Ecs there :'(
  16.    #16  
    Quote Originally Posted by jblather View Post
    Vi is a well-known, long-established, and very-loved editor. Its history dates back to the days of UNIX.

    It's shipped on every TouchPad.
    If it's shipped on every TouchPad, where is it hidden? How do I invoke it?
    Edit: OK, I found it in the Terminal.

    I have found that the Preferences in Internalz Pro allow me to set the Line Return to Windows or Linux or even i0S modes so I am now using this. Now, if only the automatic Orientation worked for Internalz Pro ....
    Last edited by Wheel_nut; 10/16/2011 at 08:03 PM. Reason: Found VI
  17. #17  
    Quote Originally Posted by pml View Post

    regarding vi:

    How do you enter the Esc key, which vi makes use of by design?
    Which Terminal do you use? Xterm, I suppose!?
    I didn't find a way to enter Ecs there :'(
    I have no clue to as what you all are talking about but I found this and I think will help you.
    Using CTRL and ESC keys on TP Virtual keyboard - WORKS!
    Other people on this board including myself have recently lamented the omission of the CTRL and ESC keys on the TouchPad's virtual keyboard. This poses a real problem for those people who NEED to use vi. While the Palm phones have a sequence to generate these characters, TouchPad users were left in the dark. Until now....

    I noticed many alternate keys don't generate characters on the screen. I suspected they were generating *something*. So I started playing with multiple-key sequences to see what I could find.

    I found out how to generate ANY control character (including ESC)!

    The CTRL key is emulated by pressing and HOLDING the 't' key, waiting for the secondary keys to pop up and hitting the right-most one. It looks like "|o". It's what's called the 'thorn' symbol.

    To send a CTRL-x, hit the 'thorn' key then, immediately hit the 'x' key. This sends a CTRL-x.

    To send a CTRL-k, hit the 'thorn' key, then press 'k'.

    To verify this is so, start up an xserver/xterm via xecutah and then start up vi and put it into 'insert' mode, type a few control characters as outlined above. You can see vi echo the control characters as "^X" and "^K".

    And the Coup de Grace is the ESC key. It's simply CTRL-[. To generate that, hit the 'thorn' key, then press '['. Simple as that. Try it in a vi session and you'll see it switches you out of 'insert' mode. I tried it locally on the TP using a local xterm, then I ssh'd to a remote machine and did the same vi test.

    Works great! Now that I discovered this, my TP is 10x more useful to me!

    Now that we know we can generate any CTRL key as well as the ESC key, would be nice if the keyboard can be patched to generate the ESC sequence with just a single keystroke as outlined above. Maybe we can get a dedicated key so we can generate ESC quickly. It's just a 'CTRL-[' or '|o-[' or 'thorn-[' - I hope a keyboard patch can emulate that. This would be a real boon to those that need to use vi from their TouchPads.

    Now only if we could get PuTTY ported to the TP....
    Last edited by jblather; 09/14/2011 at 02:30 PM.
  18. #18  
    I use OpenSSH from Preware + Putty/WinSCP SFTP on my PC. They have a howto link on Preware's OpenSSH page (iirc), and just followed that. Much much easier than typing commands on the TP's screen...
  19. #19  
    Quote Originally Posted by pml View Post

    regarding vi:

    How do you enter the Esc key, which vi makes use of by design?
    Which Terminal do you use? Xterm, I suppose!?
    I didn't find a way to enter Ecs there :'(
    http://forums.precentral.net/hp-touc...ard-works.html

    Read that thread. You'll probably want to get the Xecutah/Xserver/Xterm apps.

Posting Permissions