Scripting

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
Hey guys, I am after some language in which I can quickly knock up utilities to do what I can best describe as "stuff" things that can kinda be done in unix shells, pattern matching useful things like that, an example of what I want to do is remove all the cvs directories from a folder hierarchy...any ideas? Python, perl? I dont know!
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
jaba said:
Hey guys, I am after some language in which I can quickly knock up utilities to do what I can best describe as "stuff" things that can kinda be done in unix shells, pattern matching useful things like that, an example of what I want to do is remove all the cvs directories from a folder hierarchy...any ideas? Python, perl? I dont know!


just write it in shell, like bask or korn. everything more than that is waay overkill and will cause you brain damage. expecially perl.
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
bask is bash d'oh. stupid editor function :eek:
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
thanks clown, wicked reply! ;)
I cant use a bash script teedles as I have no access to unix or anything...other plans?
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
install cygwin? dunno. if you want to do things in unix you will require a server to play on. if you don't have a spare pc that you can install on you'll have to get a shell on the interweb somewhere. if you're very nice I might let you play on one of my servers. that's only temporary though, as I am moving my stuff to a different set of hosts.
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
nah its not that I want to do stuff in unix, its that I want to stuff like what you can do in unix but in windows... I have heard of cygwin, is it any good? can you do unixy powerfull things in it?

ooh but thanks for the offer to play on the servers though, I am a very good boy :D
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
jaba said:
nah its not that I want to do stuff in unix, its that I want to stuff like what you can do in unix but in windows... I have heard of cygwin, is it any good? can you do unixy powerfull things in it?

ooh but thanks for the offer to play on the servers though, I am a very good boy :D

ah, young padawan, you hit the nail on the head there. be aware that some of the unix powertools have been ported to doze. naturally the best thing to do is install a unx on your computer. keep a windows partition handy for games though, because that will be the only thing left to do on it :)

cygwin is a unix-like environment run from within windows. it also contains an Xserver, which is what I use it for usually if I happen to be in windows.
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
hmmm, very interesting, just out of interest and not wanting to start a ragin debate, if I wanted to stick unix/linux on a pc what should I go for? distribution wise?
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
tbh I'd see if I could install FreeBSD. on your "other" computer though, until you're comfortable enough with playing with it that you can install it without more than a slight twinge of fear. the FreeBSD handbook that you can read on their website is very good, and actually requires you to use your brain at times, which is a plus imo. Unix in general requires you to think a bit more than the average windows release does, so don't be afraid to see what you can find on the internet. here's a good place to see fBSD in action, though the bloke's gotten quite good and the current beardy-level may be a bit above beginner.

there's a thing called linux you may have heard of more often than *BSD. it's another unix-esque OS that is free, like beer should be. there are several different flavours to be had. my personal fave is something called slackware which I happen to like and have used for yonks although I no longer use linux at all. teh slack is imo one of the more pure linux flavours, and doesn't try to hide things behind wizards and automated hardware detection schemes. this tends to again place the level of beard needed at a higher point that most new people want. be aware that I muck about with commercial unixes on enterprise grade systems for a living, so I can safely say that I'm reasonably well endowed in the beard area.

if you've never ever done anything with a unix strain directly, feel free to contact me on my msn or via PM and we can talk about shells and stuff if you're up for that.
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
hehe, beard factor, I am clean shaven sadly :( when I get the puter I want to destory *cough* install *cough* unix on I would really appreciate the help matey thanks :)
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
no worries my young padawan, teach you I will, strong you will become, a fearsome beard you will grow ;)
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
Sweeeet! as long as i doesnt get all gingery and scraggly thats fine, can i oil it too?
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
as long as it's not rancid wij-oil then all is well imo :)
 

Will

/bin/su
Joined
Dec 17, 2003
Messages
5,259
FreeBSD is the one true *nix. All others are just wrong. ;)
 

sibanac

Fledgling Freddie
Joined
Dec 19, 2003
Messages
824
Will said:
FreeBSD is the one true *nix. All others are just wrong. ;)
AIX is the true *nix its got the coolest hardware to run on ! :flame:


Cygwin will let you use most of the *nix stuff (bash/grep/awk/sed ...) tho its abit on the slow side.

Tho i always end up writing everything in unreadable perl but i guess thats because i am an old perl monkey
 

SheepCow

Bringer of Code
Joined
Dec 22, 2003
Messages
1,365
Write them yourself, I've got a handy regular expression based renaming program that I wrote in c#
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
sibanac said:
AIX is the true *nix its got the coolest hardware to run on ! :flame:

*pukes*


horse cock, and you know it :flame:


;)
 

Athan

Resident Freddy
Joined
Dec 24, 2003
Messages
1,063
To totally (well almost) contradict TdC, I'd use Perl for the scripting (it's perfect for text processing especially when you want to easily do pattern matching stuff) and Debian GNU/Linux for a real 'unix' system.

I do note, however, that for the example you gave you don't even need a script. "find . -type d -a -name CVS -exec rm -rf {} \;" will remove all directories named 'CVS' under the current directory, and all their contents if any. You do, of course, need a 'unix' find command available first, which is where Cygwin or a real 'unix' comes in.

Cygwin is fine if all you want to do is play with a few things though.

-Ath
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
hehe no worries Ath. I never said perl was bad (well, debatable hehe), just a bit ott if you're starting out imo.
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
Thats the problem I dont really have access to any linux *cough* unix (sorry teedles) thing at work to use a find command, only windows im afraid. Is perl hard to use? what about something like python? Also is cygwin hard to set up?
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,801
perl looks a bit like this (it's a gag, you have to run it)

Code:
$^W=0;no strict;s/^.*$/!2 14xr01yedk18xcgaghxi01xlxrx14eqpv15ixrxexhytxq01oqnxabiwtxsvuxjx/; (undef,$v,$u)=split(//);($r=$_)=~s|[a-z]||g;foreach($r=~/\d{$v}/g){$s.=chr('1'.$_);} eval"\$_=$s\$_;s\$i\$$u\$g";print if(s/[0-9bdfgmqvw-z]|([acehjklnoprstu])/$1/g&&s/\s+!$/!\n/);

that's deliberatly vague though :( there are loads of perl webbies about. here is a cool one, use perl and you will be using this lots, and there is a site about camels ;) there's perl that runs on windows too.
as to cygwin, that's pretty easy to install. you'll need some space, and it will leave a file in your startmenu to start it, but that can be customized madly. also the installer gives you lots of choices as to what you can get. install it, take it out again, etc. also the find command works ;)
 

jaba

Fledgling Freddie
Joined
Dec 25, 2003
Messages
780
thanks tdc! those pages are very useful, lets see what I can break then :)
 

Users who are viewing this thread

Top Bottom