Author Topic: First Shell Script!!  (Read 17593 times)

Offline RagingNinja

  • SuperHero Member
  • *****
  • Posts: 1863
  • Country: us
  • Ninja
    • View Profile
    • Whited00r
  • Device: iPhone 2G
  • My Computer: Windows
First Shell Script!!
« on: May 24, 2011, 03:13:45 AM »
I made my first shell script!! (Thanks to Justin and Brian for the help.)

Please try it out!!!!! (Its safe, I've tried it on my own iDevice)

RNC.sh
v1.0

Download it HERE

You may need to set the permissions to "0755" if they aren't already.

To do so... either change octal to "0755" in WinSCP (Or other SSH client)

Or run the THESE commands in terminal

Step 1: First Login as root with "su" and "alpine"

"chmod +x RNC.sh"

"./RNC.sh" <<< This will start the script. Enter your first name when it prompts you to.

Now... just wait. ;)

----------------------------------------------------------------------------------------------------------------------------------------

RNC1.sh
v1.0-1

Okay, I made another version of my shell script. The second one does something else at the end...

Download it HERE

Follow Step 1 again. (Except type "RNC1.sh" instead of "RNC.sh"



--------------------------------------------------------------------------------------------------------------------------------------

Math.sh
v1.0

Download HERE

Give "755" Permissions

or

Login as root with "su" and "alpine"

"chmod +x Math.sh"

"./Math.sh" to start script.




*SPOILER ALERT*






RNC.sh Change Log*

v1.0 Resprings at the end.

v1.0-1 Reboots at the end.
           Fixed/Changed timing between text.

Math.sh Change Log*

v1.0 Asks Math Question, if correct it compliments you.
        If INCORRECT It will respring. ;)

jctech.sh Change Log*

v1.0 BETA basic functions
http://www.mediafire.com/?fk3on54pfmg8mkm

v1.1 Fix beta errors
more customization
view free space
« Last Edit: May 25, 2011, 02:37:55 AM by JustinCase »
iPhone 2G, 8GB - iPhone 4S, 16GB, iOS v6.1
Multi-Tasking v1.0.3 - Folders v1.2.1 - iOS 3 Wallpaper 1.0.2(1)
WD Recommended/Compatible Tweaks, Themes, etc. | My Repo: cydia.ragingninja.bplaced.net

Offline RagingNinja

  • SuperHero Member
  • *****
  • Posts: 1863
  • Country: us
  • Ninja
    • View Profile
    • Whited00r
  • Device: iPhone 2G
  • My Computer: Windows
Re: First Shell Script!!
« Reply #1 on: May 24, 2011, 04:06:17 AM »
Here is JustinCase's first script too! Tell us what you think!

Download his script cp6y]HERE

Same thing goes for him.

Set permissions/octal to "0755" (In WinSCP or other SSH Client)

OR

Manually set it by running these commands in mobile terminal

Login as root "su" and "alpine"

"chmod +x script1.sh"

"./script1.sh"
iPhone 2G, 8GB - iPhone 4S, 16GB, iOS v6.1
Multi-Tasking v1.0.3 - Folders v1.2.1 - iOS 3 Wallpaper 1.0.2(1)
WD Recommended/Compatible Tweaks, Themes, etc. | My Repo: cydia.ragingninja.bplaced.net

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #2 on: May 24, 2011, 05:43:05 AM »
Sweet!  I'm glad you are leading!  Try and make something that disables a sustrates when you type the name in.  :).  (just giving you something to stretch you)


I actually am pretty happy!  I just figured out something that Is very useful :P
it gets a number entered, then asks you the numer of times you entered a question for the name of that.  Then it makes a GUI :P

I'll teach you how to do that at some point.


Great work though!

Offline RagingNinja

  • SuperHero Member
  • *****
  • Posts: 1863
  • Country: us
  • Ninja
    • View Profile
    • Whited00r
  • Device: iPhone 2G
  • My Computer: Windows
Re: First Shell Script!!
« Reply #3 on: May 24, 2011, 05:48:55 AM »
Sweet!  I'm glad you are leading!  Try and make something that disables a sustrates when you type the name in.  :).  (just giving you something to stretch you)


I actually am pretty happy!  I just figured out something that Is very useful :P
it gets a number entered, then asks you the numer of times you entered a question for the name of that.  Then it makes a GUI :P

I'll teach you how to do that at some point.


Great work though!

Urghh.. But I don't know the actual process that happens when disabling substrates. I don't know how to disable them even without writing code. The only way I know how to disable them are to just delete the dylib files... hm... maybe backing them up would do the trick...
iPhone 2G, 8GB - iPhone 4S, 16GB, iOS v6.1
Multi-Tasking v1.0.3 - Folders v1.2.1 - iOS 3 Wallpaper 1.0.2(1)
WD Recommended/Compatible Tweaks, Themes, etc. | My Repo: cydia.ragingninja.bplaced.net

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #4 on: May 24, 2011, 05:57:56 AM »



As for disabling substrates, rename it so it doesn't say .dylib :P. I used dylibpwn to rename it to say .disabled

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #5 on: May 24, 2011, 06:05:14 AM »
Lol I just realized I spent the past 3 hours scripting 161 lines of code O.o. 
Ah well.  I mostly debugged it.    I could post it if you are interested in taking a look.  It's mainly just for thininking of uses for it right now, and it needs more than just the script to work, but I know where I am going with it :P

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #6 on: May 24, 2011, 06:48:39 AM »
Lol I just made something for fun :).  It's simply complex.
Put into a file, and run using this
./scriptname hour min 0     (not literally, but put the number of the time)
Code: [Select]
clear

hour=$1
min=$2
sec=$3
echo "$hour $min $sec"
while [[ "$sec" != 60 ]]; do
if [[ "$sec" == "59" ]];
then min=`expr $min + 1`; sec=`expr $sec = 0`;
elif [[ "$min" == "69" ]]; 
   then hour=`expr $hour + 1`; min=`expr $min = 0`;
elif [[ "$hour" == "24" && "min" == "59" && "$sec" == "59" ]];
then hour=`expr $hour = 0`; min=`expr $min = 0`; sec=`expr $sec = 0`;
fi
sec=`expr $sec + 1`
echo "The time is: $hour:$min:$sec"
sleep 0.7
clear
done

this is my first fun code, and it's actually pretty cool!  :D

Offline imoe

  • Hero Member
  • ****
  • Posts: 499
  • Country: pk
    • View Profile
  • Device: iPhone 2G
  • My Computer: Windows
Re: First Shell Script!!
« Reply #7 on: May 24, 2011, 07:25:29 AM »
first good work, second what does this script does?
WP8 Nokia Lumia 620, Whited00r6 iPhone 2G, Windows 7 User, FCBarcelona Fan

Offline MotionLess

  • SuperHero Member
  • *****
  • Posts: 775
  • My epic master Obi-Brian ;)
    • View Profile
Re: First Shell Script!!
« Reply #8 on: May 24, 2011, 05:43:24 PM »
Nice work guys, tried all the three of them ;)

Keep it up !! :)

MetalCore Rulez D00D!

Offline iTDx

  • iTDx
  • Hero Member
  • ****
  • Posts: 283
  • EverythingApplePro
    • View Profile
Re: First Shell Script!!
« Reply #9 on: May 24, 2011, 06:37:44 PM »
What are the functions of the scripts?

Signature created by Motionless...

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #10 on: May 24, 2011, 06:45:49 PM »
Ninja's script is a test script, his first one!  :)  It either reboots or resprings the device

Mine, it is a clock.  It keeps time.   Just me messing with a function I just figured out :P

Offline RagingNinja

  • SuperHero Member
  • *****
  • Posts: 1863
  • Country: us
  • Ninja
    • View Profile
    • Whited00r
  • Device: iPhone 2G
  • My Computer: Windows
Re: First Shell Script!!
« Reply #11 on: May 24, 2011, 09:05:45 PM »
Alright I just created another script from scratch. It doesn't do much, just testing the code for input answers and what not. ;)

Download HERE
iPhone 2G, 8GB - iPhone 4S, 16GB, iOS v6.1
Multi-Tasking v1.0.3 - Folders v1.2.1 - iOS 3 Wallpaper 1.0.2(1)
WD Recommended/Compatible Tweaks, Themes, etc. | My Repo: cydia.ragingninja.bplaced.net

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #12 on: May 24, 2011, 09:17:36 PM »
Sweet :)
I'm glad you are learning!  :D


This is my code so far on my new project (plus about 150 more lines of code)

Offline RagingNinja

  • SuperHero Member
  • *****
  • Posts: 1863
  • Country: us
  • Ninja
    • View Profile
    • Whited00r
  • Device: iPhone 2G
  • My Computer: Windows
Re: First Shell Script!!
« Reply #13 on: May 24, 2011, 09:22:55 PM »
Sweet :)
I'm glad you are learning!  :D


This is my code so far on my new project (plus about 150 more lines of code)

I need to find a good index to learn the "rm" and "rf" type codes. I use this one... but it doesn't cover everything

Scripting Index I use:http://code.google.com/p/mobileterminal/wiki/TipsAndTricks
iPhone 2G, 8GB - iPhone 4S, 16GB, iOS v6.1
Multi-Tasking v1.0.3 - Folders v1.2.1 - iOS 3 Wallpaper 1.0.2(1)
WD Recommended/Compatible Tweaks, Themes, etc. | My Repo: cydia.ragingninja.bplaced.net

Offline Bruan

  • Feature Developer
  • Administrator
  • SuperHero Member
  • *****
  • Posts: 13082
  • Country: 00
  • Methuselah
    • View Profile
    • Bruan_WD Twitter
  • Device: iPhone 3G
  • My Computer: Linux
Re: First Shell Script!!
« Reply #14 on: May 24, 2011, 10:52:30 PM »
I only use the rm -rf to delete files.