Shell scripting or PHP?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Shell scripting or PHP?

Post by alex.barylski »

I guess shell scripting is language independent cause I've seen examples use Python and Perl...

I'm curious though, when you need some simple script but it's complex enough to warrant conditional logic and not just chaining several commands togather, do you use the Bash scripting language or just go with PHP to get the job done?

Basically, I'd like to know if there are instances where Bash scripting would be easier -- can you provide a example?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Shell scripting or PHP?

Post by VladSun »

Most probably, *sh language would be enough, unless superior to PHP when it comes to shell scripting (especialy for automating neetwork/system administration).
Examples ... a lot of :)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Shell scripting or PHP?

Post by RobertGonzalez »

Since I am stronger at PHP I use it to write CLI scripts. I have a coworker who is very skilled in bash scripts so he writes those. Another co-worker of mine uses Awk because she is very strong in that.

Ultimately I would say use what you are comfortable doing.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Re: Shell scripting or PHP?

Post by Maugrim_The_Reaper »

I use Perl or Ruby for scripting - problem with PHP is that it's not well designed for a scripting language on the shell. It's good enough if that's what you prefer as a language, but Perl and Ruby have it beat.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Shell scripting or PHP?

Post by RobertGonzalez »

Perl hurts my brain. I haven't been in it for at least five years and no one else in the shop has either.

If I had the time to learn it again I would totally go Perl for shell script processing because as a file system level language it is hard to beat. But I am very profficient, fast and comfortable with PHP so that is what I use.
Post Reply