Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Scripting languages - Probably Python stuff too 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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


Last edited by forquare1 on Thu May 28, 2009 1:12 pm, edited 2 times in total.



Thu May 28, 2009 10:56 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Reply with quote
I tend to use python. I also like how the overzealous filter blocks @rsenal! Better to be safe than sorry, I guess, though!

Edd

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Thu May 28, 2009 11:11 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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...


Thu May 28, 2009 11:20 am
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 11:36 pm
Posts: 3527
Location: Portsmouth
Reply with quote
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.

_________________
Image


Thu May 28, 2009 4:52 pm
Profile
Doesn't have much of a life

Joined: Sat Apr 25, 2009 6:50 am
Posts: 1911
Reply with quote
Have you considered Ruby? For text manipulation it can do some very complex [LIFTED] in a single line script.


Sat May 30, 2009 7:35 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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?


Sat May 30, 2009 8:59 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
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.

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun May 31, 2009 6:53 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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?


Sun May 31, 2009 8:55 am
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
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 ).

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun May 31, 2009 9:18 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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...


Sun May 31, 2009 9:50 am
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
Probably a silly question why don't you a small java or VB application to do it?

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun May 31, 2009 10:37 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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...


Sun May 31, 2009 10:46 am
Profile WWW
Doesn't have much of a life

Joined: Sat Apr 25, 2009 6:50 am
Posts: 1911
Reply with quote
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.


Sun May 31, 2009 11:08 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
Cool, Ruby will certainly be looked at then :D


Sun May 31, 2009 11:19 am
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
ShockWaffle wrote:
I think you are confusing Ruby with Rails.

:oops: Right in one yes. :roll:

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun May 31, 2009 12:22 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.