x404.co.uk
http://www.x404.co.uk/forum/

Scripting languages - Probably Python stuff too
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=861
Page 1 of 2

Author:  forquare1 [ Thu May 28, 2009 10:56 am ]
Post subject:  Scripting languages - Probably Python stuff too

Hi all,

I do a lot of scripting to automate tasks and I find myself doing a fair amount of string manipulation, for the most part I write bourne shell scripts, and anything a little heavier I'll write a bash script, if I need more functionality, the next weapon in my @rsenal is Java, which is quite a step up...

I'm thinking I should really learn another scripting language, something more concise than bash (I can do pretty much anything in bash, it's just not particularly clean!). I'm not really looking for portability between different systems seeing as I'll be using OS specific commands, but transferable skills are always good :D

I see a lot of people using Perl around the office, and that looks horrid...Python creeps in every now and again...

So what do you guys use? Have you heard one is better than another?

Cheers,
Ben

Author:  EddArmitage [ Thu May 28, 2009 11:11 am ]
Post subject:  Re: Scripting languages

I tend to use python. I also like how the overzealous filter blocks @rsenal! Better to be safe than sorry, I guess, though!

Edd

Author:  forquare1 [ Thu May 28, 2009 11:20 am ]
Post subject:  Re: Scripting languages

I'm going to have a look at Python, last time I looked I saw it from a programming view and I felt it lacked structure (compared to Java), this time I will be looking at it from a scripting viewpoint, so hopefully I'll get on with it better...

Author:  Nick [ Thu May 28, 2009 4:52 pm ]
Post subject:  Re: Scripting languages - Probably Python stuff too

So it will block Arsenal (Ar senal) but not prick, cock, or twat?

:lol:

p.s. I've got nothing useful to add to this thread, and for those reasons ... I'm out.

Author:  ShockWaffle [ Sat May 30, 2009 7:35 pm ]
Post subject:  Re: Scripting languages - Probably Python stuff too

Have you considered Ruby? For text manipulation it can do some very complex [LIFTED] in a single line script.

Author:  forquare1 [ Sat May 30, 2009 8:59 pm ]
Post subject:  Re: Scripting languages - Probably Python stuff too

I hadn't, I presume it's similar to Perl/Python in execution? (Ie make it executable and do ./filename)
I always thought, probably wrongly, that Ruby was far more of a web scripting language?

Author:  AlunD [ Sun May 31, 2009 6:53 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

forquare1 wrote:
I hadn't, I presume it's similar to Perl/Python in execution? (Ie make it executable and do ./filename)
I always thought, probably wrongly, that Ruby was far more of a web scripting language?


You are correct its web based. Ruby is in fact AJAX in other words java script.

Author:  forquare1 [ Sun May 31, 2009 8:55 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

AlunD wrote:
You are correct its web based. Ruby is in fact AJAX in other words language from hell.


Corrected...It may have moved on, but when I learnt ECMAscript a couple of years back, it was a horrible language with meaningless errors. I swear I copied a piece of code character for character, I did a diff on it and it came out the same, yet it didn't work...I copied and pasted the code and it worked :roll:

One important thing which I have overlooked, can I use environment tools in these languages? If I want to do the following, could I?
Code:
ls -lah | awk '{print $9, $5}'

I'm sure each language brings it's own manipulation tools which would act like awk, but can I get the ls functionality?

Author:  AlunD [ Sun May 31, 2009 9:18 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

in terms of PHP,Java script, Ajax and Python ( I think ) They are server side so I don't see how they could use or see local client side machine details ( if that's what you are trying to do ).

Author:  forquare1 [ Sun May 31, 2009 9:50 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

Ahhh,

I'm not after web scripting at all :) I want an alternative for shell scripts, for example: I currently have a smallish shell script which indexes a given directory and sub directories, I want to expand this to it indexes them into an XML file, later I will want to create a program which can add other data (meta data) to the XML file, and then will eventually be looking at making a script which will create/update a webpage based on the content of the XML file. I can do this in shell script, but there is a fair amount of manipulation to be done with regards to paths and file names, and it looks very hacky, for example:
Code:
TEMP_NAME=`echo $EACH | sed 's/\(.*\)\/\([^/]*\)/\2/' | sed 's/[$.].*//' | sed 's/%20/ /g'`


I need something that can interact with 'system commands', such as `ls`, `find`, zfs commands, `fmadm faulty`, etc. to give me information about the system, a lot of these scripts will be run by cron, I could pass the data in as an argument, but it seems clunky to do that...I would also like it to be less hacky than shell scripts, they do everything I want, but it's not clean at all...

Author:  AlunD [ Sun May 31, 2009 10:37 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

Probably a silly question why don't you a small java or VB application to do it?

Author:  forquare1 [ Sun May 31, 2009 10:46 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

Only because Java feels to industrial for the job, it's almost too structured... It shouldn't take a lot, seems a bit much to start getting Java involved, but it's a little too much for bash, I was after a middle ground...Although I do know that Java will be able to use `ls, `find`, etc....

I'm going to have a closer look at Python at some point, and I'll probably take a peek at Ruby too...

Author:  ShockWaffle [ Sun May 31, 2009 11:08 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

AlunD wrote:
forquare1 wrote:
I hadn't, I presume it's similar to Perl/Python in execution? (Ie make it executable and do ./filename)
I always thought, probably wrongly, that Ruby was far more of a web scripting language?


You are correct its web based. Ruby is in fact AJAX in other words java script.

I think you are confusing Ruby with Rails.

Ruby is a fully object oriented scripting language that runs on any machine you like, is popular (albeit it less so than Python and Perl) for system administration tasks, and includes precisely zero Java Script. Ruby on Rails is something else, about which I know little because I'm not interested in web development atm.

Author:  forquare1 [ Sun May 31, 2009 11:19 am ]
Post subject:  Re: Scripting languages - Probably Python stuff too

Cool, Ruby will certainly be looked at then :D

Author:  AlunD [ Sun May 31, 2009 12:22 pm ]
Post subject:  Re: Scripting languages - Probably Python stuff too

ShockWaffle wrote:
I think you are confusing Ruby with Rails.

:oops: Right in one yes. :roll:

Page 1 of 2 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/