Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Nomnom Cookie
Aug 30, 2009



does python have a decent way to run commands and get their exit status

Adbot
ADBOT LOVES YOU

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Nomnom Cookie posted:

centos has perl 5.10 is that good enough to do things with

that is an excellent perl; ignore the naysayers

Stringent
Dec 22, 2004


image text goes here

USSMICHELLEBACHMAN posted:

if you're writing perl you might as well just write bash

this is so stupid it drools.

perl is exactly what you want to be using and 5.10 is fine.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Nomnom Cookie posted:

does python have a decent way to run commands and get their exit status

i dont know i'm sure it does


ruby does

you can do %x[program argument argument argument] and it escapes everything for you and just works. plus it has like 20 other methods of executing commands for if you want to block or not block them or get their pid or w/e

a cyberpunk goose
May 21, 2007

Nomnom Cookie posted:

does python have a decent way to run commands and get their exit status

code:
from subprocess import call
result = call(["ls", "-l"])
result holds the exit status/return code

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Stringent posted:

this is so stupid it drools.

perl is exactly what you want to be using and 5.10 is fine.

there's help for people like you. look up the perl stockholm victims foundation

Nomnom Cookie
Aug 30, 2009



Mido posted:

code:
from subprocess import call
result = call(["ls", "-l"])
result holds the exit status/return code

i found subprocess.check_call all by myself! it looks like exactly what i want for replacing bash -e

Nomnom Cookie
Aug 30, 2009



USSMICHELLEBACHMAN posted:

i dont know i'm sure it does


ruby does

you can do %x[program argument argument argument] and it escapes everything for you and just works. plus it has like 20 other methods of executing commands for if you want to block or not block them or get their pid or w/e

ruby has a million things and I'm not going to remember them all

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
you only need to remember the ones oyu like

Stringent
Dec 22, 2004


image text goes here

Nomnom Cookie posted:

i found subprocess.check_call all by myself! it looks like exactly what i want for replacing bash -e

if you're looking for a scripting language for server janitoring you're really doing yourself a disservice not going with perl.

as much for the community and libraries as the language itself, since that's primarily what it's used for.

i realize it isn't very cool, but it is effective.

Nomnom Cookie
Aug 30, 2009



also i don't like ruby

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Nomnom Cookie posted:

also i don't like ruby

the feeling is mutual

Nomnom Cookie
Aug 30, 2009



Stringent posted:

if you're looking for a scripting language for server janitoring you're really doing yourself a disservice not going with perl.

as much for the community and libraries as the language itself, since that's primarily what it's used for.

i realize it isn't very cool, but it is effective.

i don't want to janitor servers just write my workflow scripts in something better than bash

uG
Apr 23, 2003

by Ralp
perl 5 has copied lots of ruby poo poo but better (its not ruby for one). it will also have a mop in a year or two. for hipsters who use ruby because its a fad there will be perl 6

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

quote:

it will also have a mop in a year or two.

computer janitors don't need a mop it's just an expression you idiot

a cyberpunk goose
May 21, 2007

Nomnom Cookie posted:

i don't want to janitor servers just write my workflow scripts in something better than bash

python is easy to read when you return to it and is very sane for workflow poo poo

Stringent
Dec 22, 2004


image text goes here

Nomnom Cookie posted:

i don't want to janitor servers just write my workflow scripts in something better than bash

you said throwaway earlier, what's your workflow?

a cyberpunk goose
May 21, 2007

but once your python poo poo starts growing into like 5 class monstrosities that break into 12 different files you're gonna start not enjoying all the duck typing bullshit when your poo poo breaks

unless you unit test the gently caress out of whatever awful thing you're doing

Stringent
Dec 22, 2004


image text goes here

Mido posted:

but once your python poo poo starts growing into like 5 class monstrosities that break into 12 different files you're gonna start not enjoying all the duck typing bullshit when your poo poo breaks

unless you unit test the gently caress out of whatever awful thing you're doing

he already said his monstrosities are in java

uG
Apr 23, 2003

by Ralp

USSMICHELLEBACHMAN posted:

computer janitors don't need a mop it's just an expression you idiot

your meta object protocol is a piece of poo poo

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
you mgiht need a mop after using perl for a week and blowing your brains out all over your cube

a cyberpunk goose
May 21, 2007

i need to clean up my spoken language

i get all feisty when i talk about computer sh-... stuff

Nomnom Cookie
Aug 30, 2009



Stringent posted:

you said throwaway earlier, what's your workflow?

repetitive dev tasks, they're usually different for each project. this month i need to build, deploy a war, restart 4 tomcats, and load test data multiple times a day. currently that sort of thing gets a bash script. i say throwaway because these scripts are write-once and tailored to the repetitive dev task of the month

uG
Apr 23, 2003

by Ralp
why use bash when perl is installed on everything even if you hate perl at least its not bash

a cyberpunk goose
May 21, 2007

Nomnom Cookie posted:

repetitive dev tasks, they're usually different for each project. this month i need to build, deploy a war, restart 4 tomcats, and load test data multiple times a day. currently that sort of thing gets a bash script. i say throwaway because these scripts are write-once and tailored to the repetitive dev task of the month

i use python to automate a lot of string parsy poo poo because messing* iwth strings is relatively sane in python, ergo i parse a bunch of xml files and move info around to basically compile resources for game stuff i do

so i have a whole little toolchain of temporary/barely reusable scripts

edit: language

Stringent
Dec 22, 2004


image text goes here

Nomnom Cookie posted:

repetitive dev tasks, they're usually different for each project. this month i need to build, deploy a war, restart 4 tomcats, and load test data multiple times a day. currently that sort of thing gets a bash script. i say throwaway because these scripts are write-once and tailored to the repetitive dev task of the month

well, if you just want to make system calls same as bash, perl's the way to go.

if you think you'd like to use libraries steer clear because cpan can be a real pita.

Stringent
Dec 22, 2004


image text goes here

Mido posted:

i use python to automate a lot of string parsy poo poo because messing* iwth strings is relatively sane in python, ergo i parse a bunch of xml files and move info around to basically compile resources for game stuff i do

so i have a whole little toolchain of temporary/barely reusable scripts

edit: language

oh god

nonononono

string parsing is what perl is loving for!!!!

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Stringent posted:

well, if you just want to make system calls same as bash, perl's the way to go.

if you think you'd like to use libraries steer clear because cpan can be a real pita.

cpan owns

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
perl is great at string parsing the problem is that once your'e doing parsing those strings you cant do anything useful with them because you're stuck in perl

Stringent
Dec 22, 2004


image text goes here

prefect posted:

cpan owns

until you need an older version of something

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

uG posted:

perl at least its not bash

this

reading perl code is somewhat entertaining to me (maybe because I never had to really work with it) but reading bash scripts is just painful

a cyberpunk goose
May 21, 2007

Stringent posted:

oh god

nonononono

string parsing is what perl is loving for!!!!

no gently caress off

im not talking about parsing strings im talking about working with them

contorting them, slamming them together, moving poo poo around once you have them

Stringent
Dec 22, 2004


image text goes here

Mido posted:

no gently caress off

im not talking about parsing strings im talking about working with them

contorting them, slamming them together, moving poo poo around once you have them

yes, perl owns for this

tef
May 30, 2004

-> some l-system crap ->

Mido posted:

but once your python poo poo starts growing into like 5 class monstrosities that break into 12 different files you're gonna start not enjoying all the duck typing bullshit when your poo poo breaks

unless you unit test the gently caress out of whatever awful thing you're doing

yep

uG
Apr 23, 2003

by Ralp

Stringent posted:

if you think you'd like to use libraries steer clear because cpan can be a real pita.

this is the dumbest thing in this thread

Stringent
Dec 22, 2004


image text goes here

uG posted:

this is the dumbest thing in this thread

its a matter of taste i admit.

perl's got a lot of great libraries with great testing and probably a higher average level of code quality than python or ruby.

that said, i find gem and pip about a billion times easier to work with than cpan, especially across multiple machines.

ymmv v0v

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
personally i write all my string janitoring scripts in c

a cyberpunk goose
May 21, 2007

Mr SuperAwesome posted:

personally i write all my string janitoring scripts in c

Notorious b.s.d.
Jan 25, 2003

by Reene
perl, Python, and ruby are all much more similar than they are different. They're all slow, they share a lot of the same awful implementation problems, they all have half baked type systems

They're all better for cj poo poo than bash. I don't care which one you use just don't use bash/ksh.

People who get butthurt bout the trivial differences between scripting languages should be tied down and forced to debug ksh code. A full 40 hour work week for every time they bring it up.

Adbot
ADBOT LOVES YOU

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
perl loving sucks for text manipulation what the gently caress are you gibbering fools blathering on about, INSANITY, theres no way to even manipulate a loving text file at ALL in perl. its worthless leftover glue garbage from slackware autists who couldnt possibly fathom writing a shell script more than four lines long. throw it in the trash

  • Locked thread