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?
Shell scripting or PHP?
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Shell scripting or PHP?
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
Examples ... a lot of
There are 10 types of people in this world, those who understand binary and those who don't
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Shell scripting or PHP?
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.
Ultimately I would say use what you are comfortable doing.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Re: Shell scripting or PHP?
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.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Shell scripting or PHP?
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.
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.