Results 1 to 10 of 10

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Shell Scripts iPhone

  1. #1
    Default Shell Scripts iPhone
    I am having trouble getting shell scripts working in the iPhone.

    Scripts of the type

    #!/bin/bash
    echo "foo"

    Do not work. I have set the permission correctly and tried changing the first line to #!/bin/sh in addition to trying to run it in the default zsh.

    Help?

  2. #2
    I wish I can help you. I was going to look into this for you, but I am having issues with term v100. I will try and get back to you when I get the darn thing working. Not sure why it stopped working for me. I used it the other day.

    - Garrett

    Very weird term v100 stopped working for me and Mobileterm works find for me now as it was having issues in the past. To try and help you further, how are you running your scripts? Are you running them in the directory the are located? Have you tried using ./scriptname and see if that works? Does it give you any error message or any thing in return?

    - Garrett
    Last edited by garretwp; 09-17-2007 at 02:22 AM. Reason: Automerged Doublepost

  3. #3
    hmm ... interesting ..
    bash is owned by 'mobile' ...
    I tried to chown the script ... but i got a 'memory exhausted'
    so i checked with 'top' ... only 2.38 mb free
    damn springboard ...
    Best Regards

  4. #4
    As far as I know a bash script wont run under zsh. I could be wrong though.

    I have successfully changed the default shell to bash. with a working history, and .bash_profile. I'll post a how to after work. to give you a head start check out the dev team's website and browse for the CLI applications. Look under more unix stuff, and download the undated BASH shell. It works much better then the version that comes with BSD subsystem via installer. You can use it as the default in master.password without it crashing your phone.

    ps. The only version of Terminal that seems to work (well at least) is the iterm branch version 153. you can get that here.

    http://www.modmyi.com/forums/attachm...3&d=1187982824
    Last edited by mrengles; 09-17-2007 at 07:16 AM. Reason: Terminal Notes
    Gratitude,
    mrengles

  5. #5
    Quote Originally Posted by garretwp View Post
    To try and help you further, how are you running your scripts? Are you running them in the directory the are located? Have you tried using ./scriptname and see if that works? Does it give you any error message or any thing in return?

    - Garrett
    I am running them from the directory where it resides. I placed it in the default location for the shell (var/root) and used the command ./scriptname to invoke it. I modified the permissions with chmod 755 scriptname

    I have tried from bash, tcsh, and even zsh.

    When I run from bash this is what I get.

    bash-3.2# ./scriptname
    bash: ./scriptname: /bin/sh: bad interpreter: Permission denied

    And also, yes, I would love to know how to set bash as the default. I will try to find the newer one.

    Thanks everyone.

  6. #6
    Quote Originally Posted by Homer1946 View Post
    I am running them from the directory where it resides. I placed it in the default location for the shell (var/root) and used the command ./scriptname to invoke it. I modified the permissions with chmod 755 scriptname

    I have tried from bash, tcsh, and even zsh.

    When I run from bash this is what I get.

    bash-3.2# ./scriptname
    bash: ./scriptname: /bin/sh: bad interpreter: Permission denied

    And also, yes, I would love to know how to set bash as the default. I will try to find the newer one.

    Thanks everyone.
    I couldn't run any bash shell scripts from var/root. I got the same thing you are getting. I created a folder /scripts in the root and put the scripts there and they worked perfect. No real idea why this is but haven't really researched it.

    -Steve

  7. #7
    The partition where the home directory is located is mounted with a noexec option.

    remove the noexec option from the /private/var line in your /etc/fstab file, and reboot

  8. The Following User Says Thank You to fezziwig For This Useful Post:

    scr4p (09-19-2007)

  9. #8
    Quote Originally Posted by fezziwig View Post
    The partition where the home directory is located is mounted with a noexec option.

    remove the noexec option from the /private/var line in your /etc/fstab file, and reboot
    Ah... nice!

    Thanks!

  10. #9
    That fixed it! Thanks

  11. #10
    Green Apple
    Join Date
    Jun 2007
    Location
    Baltimore
    Posts
    78
    Thanks
    4
    Thanked 3 Times in 2 Posts

    Quote Originally Posted by Homer1946 View Post
    And also, yes, I would love to know how to set bash as the default. I will try to find the newer one.

    Thanks everyone.
    The new one is here:

    http://www.sendspace.com/folder/err8qc

    to install it do:

    mv /bin/bash /bin/bash.original
    cp /path/to/new/bash /bin/bash

    then edit the /etc/master.passwd file and under the line that starts with root change the /bin/sh to say /bin/bash towards the end of the line..

    note: open up a new ssh window to the phone to test it before closing the one you're in in case something went wrong and you can't get in, you can still fix it.

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •