LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2014, 10:56 AM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 472

Rep: Reputation: 29
Bash scripting vs perl


A Linux / perl expert told me i am wasting my time learning bash scripting at this stage and should go straight onto learning Perl...would you agree with this?
i started reading a book on shell scripting, but am thinking now if i should get a good perl book...
 
Old 04-18-2014, 11:04 AM   #2
netnix99
Member
 
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 98
I'd say learn both...

You will find some systems, like *BSD do not come standard with BASH (though it could be installed), and others, such as a minimal Red Hat load, doesn't install perl by default. I would say the best approach is learning both OR learning the one that is most prevalent in your particular environment. If your environment includes both, I would opt for the perl, as it is a high-level language... Once you have it down, you will be amazed at how easy you can pick-up shell scripting for smaller tasks along the way.
 
Old 04-18-2014, 11:18 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Since you asked what BASH was used for about half a year ago I'd like to ask some questions: do you need shell scripting skills? If you do, what tasks have you used it for? Have you made scripts that were used (preferably in a production environment)? Did you have scripts blow up in peoples faces reminding you that error handling is more important than pretty-printing output? What would replacing your scripts with a PERL script accomplish in terms of combating code rot, ease of maintenance or performance? Will you need PERL knowledge in the near future? If you have no clue about this all then you're ready to start learning PERL from scratch and without any idea what to do with the knowledge ;-p Me, I'd rather go solve a problem than read a book on PERL. When I encounter a problem then I'll stop and read. But of course everyone is free to choose their own approach...
 
Old 04-18-2014, 12:37 PM   #4
tabbygirl1990
Member
 
Registered: Jul 2013
Location: a warm beach, cool ocean breeze, nice waves, and a Margaritta
Distribution: RHEL 5.5 Tikanga
Posts: 63

Rep: Reputation: 1
perl looked waaaay too scary to me!!!

i try to write in awk and bash and sed - only been writting for a year or two as i need to.

i know a serious tek head who knows a bunch of languages and he really suggests python, says it has way more power than perl and easier to learn, but idk.

good luck, tabby
 
Old 04-18-2014, 01:12 PM   #5
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
It depends on what you want to accomplish. Learning bash is definitely not a waste of time. Perl is more powerful than bash in the sense that it can do more, but it can be slower and more convoluted, and it may not be what you need.
 
Old 04-18-2014, 06:29 PM   #6
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 472

Original Poster
Rep: Reputation: 29
Hi guys thanks for all the input. I do not work in the unix industry. I work in a windows enviroment but have been focussing more on linux the last year or so. I am busy doing a few certs to further my knowledge and wondered about bash scripting vs perl in the real world...wouldnt want to involve myself with something that was becoming obsolete. Which is sort of what my friend was telling me about. Im looking to focus on the LAMP stack and want to become skilled with apache and databases etc etc...any skills you guys think are very neccesary let me know.

Thanks
 
Old 04-18-2014, 06:54 PM   #7
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
Neither bash nor perl will become obsolete anytime soon. If you aren't sure you will be using Linux in the future then perl would be the way to go. If you want to be a Linux sysadmin then bash would be the way to go.
 
Old 04-19-2014, 02:44 AM   #8
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
Forgive me, but the only waste of time was when you talked with the "expert".
First of all, learning new things is never a waste of time.
Secondly, bash/shell scripting will be always useful and in my opinion is mandatory learn it.

In addiction shell scripting is not hard so, when you will have familiarity with it, you can learn perl too.
Have fun.
 
Old 04-19-2014, 02:43 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
Quote:
Originally Posted by metaschima View Post
It depends on what you want to accomplish. Learning bash is definitely not a waste of time. Perl is more powerful than bash in the sense that it can do more, but it can be slower and more convoluted, and it may not be what you need.
Actually, it is faster.

The time to use perl is when you want something safe. It is easier to get quoting correct, and getting the script secured is just as easy (just turn on the "taint" flag, and fix the errors reported).

For large scripts, perl is better. For small simple scripts bash is sometimes easier.
 
Old 04-19-2014, 02:45 PM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
Quote:
Originally Posted by metaschima View Post
Neither bash nor perl will become obsolete anytime soon. If you aren't sure you will be using Linux in the future then perl would be the way to go. If you want to be a Linux sysadmin then bash would be the way to go.
Both would be the way to go.

bash lets you interpret most things the system does (except when it gets to systemd based systems).

Perl lets you do very complex things that bash just fails at.

Both are useful for system administrators.
 
Old 04-19-2014, 03:24 PM   #11
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
What about Windoze ? The OP said they do not work in the unix industry. AFAIK, the only way to run bash on Windoze is through cygwin.
 
Old 04-20-2014, 05:40 AM   #12
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 472

Original Poster
Rep: Reputation: 29
Really thanks a lot...you guys have given me the answers i was looking for...bash here i come...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scripting, perl or bash; run a background process, get pid 2ck Programming 6 04-02-2010 01:16 AM
Reading a bash variable in bash scripting problem freeindy Programming 3 11-27-2008 03:29 AM
Perl or bash scripting? philipina Linux - General 1 07-26-2004 05:30 AM
Perl scripting Rameriez Programming 4 02-03-2003 02:01 AM


All times are GMT -5. The time now is 05:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration