1. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

Help with writing a script

Discussion in 'Android Hacks and Help' started by RichStevenson, Jun 15, 2010.

  1. RichStevenson
    Offline

    RichStevenson New Member

    Joined:
    Nov 11, 2009
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Medina, OH
    Trying to write a script and am having no luck getting it to run the way I want. So I've started from the very beginning and am now trying to write a simple Hello World script. Here's what I have:

    #!/system/bin/sh
    echo Hello World

    Named the file vpndns and saved it to \system\xbin

    \system\xbin is in my path. Verified with the set command.

    When I run it as:
    vpndns
    I get Permission Denied so I cd to \system\xbin and chmod 755 vpndns.

    Now when I run it I get "not found".
    If I change to the \system\xbin\ I receive the same error. But if I run it as:
    sh vpndns
    it runs.

    My intent was to run it without the 'sh' from any dir. Can anyone shed some light on what I'm doing wrong?
    Thanks
  2. skourg3
    Offline

    skourg3 New Member

    Joined:
    Dec 14, 2009
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    0
    Yep. You're missing quotes around your Hello World. I just threw one together. Making sure system is mounted rw, then I did

    cd /system/xbin
    touch hworld
    echo "#!/system/bin/sh" > hworld
    echo "echo \"Hello World\"" >> hworld
    hworld

    output...
    /system/sbin #hworld
    hworld
    Hello World

    I did it this way because I'm not sure how to use the busybox version of vi (through adb, anyway), and I was too lazy to see if there was another editor present; you definitely don't need to write a script using redirects like that.
  3. defleopard98
    Offline

    defleopard98 New Member

    Joined:
    Dec 25, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rolling Meadows, IL
    I don't think you need the quotes.

    Are you using Windows? The error might lie in the line ending (newline vs carriage return-newline)
    You can try using an editor supporting unix line endings (i think notepad++ does) or typing it on your phone.
  4. soniat
    Offline

    soniat New Member

    Joined:
    Aug 9, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    In writing a good academic work the writer should clearly identify the thesis of the study. This will help the writer in organizing the paper and thus the thesis statement determines ho the paper would look like. The statement should clearly state the reason for carrying out the study and the positive impact of the study. The last week i have planned to buy term papers online due to my lack of academic writing skills. The thesis statement should be brief and should include the theme of the paper.
Search tags for this page
android write script
,

how to write an android script

,

how to write android scripts

,

how to write scripts for android

,
how to write scripts for antroid
,
how to write scripts for droid razor
,
newline
,
script writing for android
,
writing android script
,

writing scripts for android