Author Topic: Run multiple commands in terminal like the setup tool?  (Read 3028 times)

Offline 0Summ1n

  • Hero Member
  • ****
  • Posts: 122
  • Country: br
  • whited00r user, developer/Hacker
    • View Profile
    • AEOS 7 (ios 7 on 3.x)
  • Device: iPhone 3G
  • My Computer: Windows
Run multiple commands in terminal like the setup tool?
« on: October 08, 2013, 06:17:14 PM »
is there a way i can make an app that could run terminal commands? i downloaded some java plugins for terminal, and i am able to run some class files via terminal, but i wonder if that is possible from an app? or , in terminal, instead of typing java (classname) type something else like "options" so when the user types that it does (cd  /var/mobile/options) then (java options), and make that all into one command, is that possible?

Edit by bcooperizcool to provide relevant keywords in the title :)
AEOS 7, ios 7 on your old idevice see this link for more http://adf.ly/SB1mO

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: Run multiple commands in terminal like the setup tool?
« Reply #1 on: October 08, 2013, 06:35:00 PM »
Do you mean via obj-c, as in an actual app, or just an icon to run terminal commands?  (shell commands/command line stuff?).

Yes, it is possible. Easiest thing though would just be to make a shell script that has those commands called "options" that the users types in and it runs those commands.

Really not sure what you want to do though...  Do you want a separate app (icon that opens into an app either with buttons or a text box for entering commands), or something within the terminal app that the user types in to make the typing shorter for them?

Offline 0Summ1n

  • Hero Member
  • ****
  • Posts: 122
  • Country: br
  • whited00r user, developer/Hacker
    • View Profile
    • AEOS 7 (ios 7 on 3.x)
  • Device: iPhone 3G
  • My Computer: Windows
Re: Run multiple commands in terminal like the setup tool?
« Reply #2 on: October 08, 2013, 06:45:47 PM »
something similar to the "setup" command except in java.
btw i guess the command could be writtten in shell
but  how will i write this in shell:

cd /var/mobile/options

java options
AEOS 7, ios 7 on your old idevice see this link for more http://adf.ly/SB1mO

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: Run multiple commands in terminal like the setup tool?
« Reply #3 on: October 08, 2013, 07:08:30 PM »
Yeah, something like that would be easy.

To avoid the user needing to type in "java options" you can make a small bash script that does exactly those commands.

Code: [Select]
#!/bin/bash
cd /var/mobile/options
java options

Name it something like "options" and chmod it, put it in /usr/bin (assuming there is no file named options there!) and then just type "options" into terminal, and it will run those commands.

Offline 0Summ1n

  • Hero Member
  • ****
  • Posts: 122
  • Country: br
  • whited00r user, developer/Hacker
    • View Profile
    • AEOS 7 (ios 7 on 3.x)
  • Device: iPhone 3G
  • My Computer: Windows
Re: Run multiple commands in terminal like the setup tool?
« Reply #4 on: October 08, 2013, 07:13:57 PM »
thanks! it's nice having an experienced programmer on the forums :D
AEOS 7, ios 7 on your old idevice see this link for more http://adf.ly/SB1mO

Offline 0Summ1n

  • Hero Member
  • ****
  • Posts: 122
  • Country: br
  • whited00r user, developer/Hacker
    • View Profile
    • AEOS 7 (ios 7 on 3.x)
  • Device: iPhone 3G
  • My Computer: Windows
Re: Run multiple commands in terminal like the setup tool?
« Reply #5 on: October 08, 2013, 07:51:06 PM »
wait, i runned options in terminal and it says permission denied, i tryed again with su and alpine login, same error.
AEOS 7, ios 7 on your old idevice see this link for more http://adf.ly/SB1mO

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: Run multiple commands in terminal like the setup tool?
« Reply #6 on: October 08, 2013, 08:30:09 PM »
wait, i runned options in terminal and it says permission denied, i tryed again with su and alpine login, same error.

Did you chmod it? (set the right permissions)

Offline 0Summ1n

  • Hero Member
  • ****
  • Posts: 122
  • Country: br
  • whited00r user, developer/Hacker
    • View Profile
    • AEOS 7 (ios 7 on 3.x)
  • Device: iPhone 3G
  • My Computer: Windows
Re: Run multiple commands in terminal like the setup tool?
« Reply #7 on: October 08, 2013, 08:45:11 PM »
how could i chmod a file? i don't recognize linux commands really well xD sorry, i did chmod --hep and it seems i have to do chmod [mode] , i tried chmod options and it didn't work
AEOS 7, ios 7 on your old idevice see this link for more http://adf.ly/SB1mO

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: Run multiple commands in terminal like the setup tool?
« Reply #8 on: October 08, 2013, 09:02:09 PM »
how could i chmod a file? i don't recognize linux commands really well xD sorry, i did chmod --hep and it seems i have to do chmod [mode] , i tried chmod options and it didn't work

chmod 775 myScript (as root though).

Offline AnimateDread

  • SuperHero Member
  • *****
  • Posts: 741
  • Country: ca
  • Learning developer
    • View Profile
  • Device: iPod Touch 1G
  • My Computer: Windows
Re: Run multiple commands in terminal like the setup tool?
« Reply #9 on: October 09, 2013, 04:28:08 AM »
I am actually a good programmer too and I have free time, I know how to reproduce a script that act like the whited00r Setup, it isn't too hard. We use basic shell functions and loops(the loops are only to detect mispelling in answers, more professionnal and allow to correct the spelling mistake)
I can do a lot of stuff

Some sma credits:I learnt shell programming(and bit of objective-c) from bcooperizcool.
Soutient en Francais ici

Offline 0Summ1n

  • Hero Member
  • ****
  • Posts: 122
  • Country: br
  • whited00r user, developer/Hacker
    • View Profile
    • AEOS 7 (ios 7 on 3.x)
  • Device: iPhone 3G
  • My Computer: Windows
Re: Run multiple commands in terminal like the setup tool?
« Reply #10 on: October 09, 2013, 02:20:27 PM »
xD, i used java to make the script,  i have no idea on using shell or objective c, i can only interpret objective c and shell.
basically what can shell do? and where or how can i learn it?

(i have a linux boot disc, in case you might want to know)
AEOS 7, ios 7 on your old idevice see this link for more http://adf.ly/SB1mO

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: Run multiple commands in terminal like the setup tool?
« Reply #11 on: October 09, 2013, 03:44:13 PM »
Shell is good for batch commands and file system stuff mostly, for automating things that would be done via the command line.  I kind of stretched what you can/should do with shell by making apps using it...