Thread: Shell Scripting
Dbyt3r

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:
commentSpam='/home/[username]/tools/comment.py'
trackbackSpam='/home/[username]/tools/tb.py'

then, I start running the stuff, i.e.:

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 Applause.

perkiset

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:


#! /usr/local/bin/

php

 
<?

php

 
        require_once($_SERVER['argv'][1]);
?>


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

php

 "

/p

thedarkness

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 

perkiset

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.  Applause 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.

thedarkness

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

Cheers,
td

Dbyt3r

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?

Applause  Applause

thedarkness

quote author=Dbyt3r link=topic=108.msg601#msg601 date=1177587625

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.

quote author=Dbyt3r link=topic=108.msg601#msg601 date=1177587625

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

Dbyt3r

Great. Thanks a bunch!

perkiset

Perk weighs in:

"Yup."

/p

JasonD

screen is your friend

perkiset

Computah says no...

thedarkness

quote author=JasonD link=topic=108.msg645#msg645 date=1177627564

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


Perkiset's Place Home   Politics @ Perkiset's