The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 19, 2019, 05:36:10 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Shell Scripting  (Read 5891 times)
Dbyt3r
Rookie
**
Offline Offline

Posts: 19


View Profile
« on: April 25, 2007, 12:27:21 PM »

You gotta love it. Its as simple as hell and could actually be used to "merge" whatever tools you want together. I usually use it to run several spamming tools in the same command and stuff.

Here's how I use it to run multiple stuff:

files can be saved in any format, usually: no format, .sh or well I dunno.

then I open it in gedit, make variables(strings) pointing to where my tools are, ex:
Code:
commentSpam='/home/[username]/tools/comment.py'
trackbackSpam='/home/[username]/tools/tb.py'
then, I start running the stuff, i.e.:

Code:
python commentSpam
python trackbackSpam
Best thing about it is that you can run practically anything that your bash knows about.

I make it seem lame, but its actaully pretty handy Wink.

Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: April 25, 2007, 12:33:39 PM »

Not lame at all... quite good actually. I do this with PHP as well, but I put the shell command right up at the top and change the mod of the file so that is standalone executable ie:

#! /usr/local/bin/php
<? include "/www/sites/myfile.php" ?>

I've even got my own "run" command for php scripts that I don't change the mod to - looks like this and works great:

Code:
#! /usr/local/bin/php
<?php
        
require_once($_SERVER['argv'][1]);
?>


... so that I can say "run myscript.php"

/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #2 on: April 25, 2007, 05:02:13 PM »

Perk, why not just "php myscript.php". I use that syntax for testing but if I use a script enough from the command line it's add the shebang, "chmod +x myscript.php" and "mv myscript.php /usr/local/sbin/". I can of course then run it by just typing its name.

Can we have a subboard here for shell scripting Perk, I got a few interesting ones.

Cheers,
td 
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: April 25, 2007, 05:03:38 PM »

Fair enough, subboard going up.

Regarding the other, I could very easily do that - but I like "run" - it's sort of 6502ish and makes me feel all warm and cuddly.  Wink Also, I usually trick that out with things like not requiring the .php on the end, adding other params for testing... this sort of thing. I change it up often.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #4 on: April 25, 2007, 07:26:00 PM »

Hey, like I've said many time "whatever floats your boat" is cool by me, we all got our own quirks.

Cheers,
td
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
Dbyt3r
Rookie
**
Offline Offline

Posts: 19


View Profile
« Reply #5 on: April 26, 2007, 04:40:25 AM »

Since I'm probably one of the youngest people that came into contact with shell scripting I think I deserve to ask a question :p .. Can I multithread or send out asynchronous calls to programs so that I can run my stuff in a parallel kinda way?

 Nerd  Shocked
Logged

No links in signatures please
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #6 on: April 26, 2007, 06:27:19 AM »

Since I'm probably one of the youngest people that came into contact with shell scripting I think I deserve to ask a question :p


LOL, OK junior.

Can I multithread or send out asynchronous calls to programs so that I can run my stuff in a parallel kinda way?

Start here
http:// tldp.org/LDP/abs/html/subshells.html

Example 20-3

HTH,
td
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
Dbyt3r
Rookie
**
Offline Offline

Posts: 19


View Profile
« Reply #7 on: April 26, 2007, 07:43:55 AM »

Great. Thanks a bunch!
Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #8 on: April 26, 2007, 01:52:04 PM »

Perk weighs in:

"Yup."

/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
JasonD
Expert
****
Offline Offline

Posts: 100


View Profile
« Reply #9 on: April 26, 2007, 03:46:04 PM »

screen is your friend
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #10 on: April 26, 2007, 04:06:32 PM »

Computah says no...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #11 on: April 26, 2007, 04:17:00 PM »

screen is your friend

Yeah, haven't played with it myself (I do the "nohup myscript &" thing mostly) but I've got a friend who swears by it and I've been meaning to take a look.

Cheers,
td
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!