LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-22-2015, 08:52 PM   #1
sriram91
LQ Newbie
 
Registered: Feb 2015
Posts: 6

Rep: Reputation: Disabled
Post Best Scripting Language for beginner : Bash vs Python vs Perl


I have reasonable experience in linux based systems. I want to learn a scripting language , can anyone out there suggest which one is the best to start with ? I would be grateful if anyone can provide me with links / books references as well ...

Last edited by sriram91; 02-22-2015 at 09:13 PM.
 
Old 02-22-2015, 09:40 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Best like most things would be in the eye of the user. Generally the best tool for the job is a better way to go.

In the case of learning I would probably say Perl as you will learn not only about scripting but hopefully good habits too which can then be applied to the others.

As far as references go, really searching will return plenty and some will appeal and others not, but here is one:

http://www.perl.org/books/beginning-perl/
 
1 members found this post helpful.
Old 02-23-2015, 04:41 AM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Bash is good shell scripting language.

You definitely should learn a shell plus

Perl or Python

Both are good.

Perl has many external modules through CPAN.

Python is more at news these days.
 
Old 02-23-2015, 05:34 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
it was discussed several times: http://www.linuxquestions.org/questi...ipting-886094/, but first you need to learn bash (if you are not familiar with it)

http://www.linuxquestions.org/questi...2/#post5316361

Last edited by pan64; 02-23-2015 at 05:39 AM.
 
1 members found this post helpful.
Old 02-23-2015, 09:52 AM   #5
RobInRockCity
Member
 
Registered: Feb 2015
Posts: 141

Rep: Reputation: Disabled
Newest Newbie here.

What exactly would you use Perl or Python for in Linux?

All I know is that "Shell" is a program that takes commands from the keyboard and sends them to Linux for processing. And the totality of my shell knowledge is how to access my VPS using SSH and how to copy a file to another directory while maintaining its original modified date!

I guess I don't really understand what shell is sued for besides simple one-off commands.

It is pretty hard for me to figure out where Perl or Python would come in?! (I am a programmer by nature, and used to building websites. When I think of something like Python, I think of building an e-commerce or social media website...)

Sincerely,


Rob
 
Old 02-23-2015, 10:25 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
actually a shell script is a collection of commands to execute them automatically without typing them again and again. but of course it can do a bit more (not only execute commands), because it has variables, redirection, loops and a lot of other features.
Sometimes the capabilities of the shell are not really enough. python, perl and several other languages are more powerful, so you can implement much complex logic or workflow.
 
Old 02-23-2015, 10:33 AM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
As has been said before, bash is essential (especially at work) because it's always there, but you can't be sure of having Python or Perl.

The only home-made bits of bash that I have are scripts, one for for backing up, and one that runs at boot and removes flash cookies (evil!), thumbnails (they breed like wire coathangers), and gvfs-metadata (ditto).

http://tldp.org/LDP/abs/html/
shows a lot of things done with bash, ranging from finding the days between two dates, through making a dictionary, to an implementation of the game of Life.
 
Old 02-23-2015, 01:20 PM   #8
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,493

Rep: Reputation: Disabled
Basically, the shell runs O/S commands in various ways, whilst Perl, Python, LUA, etc, are (non compiling) programming languages, they are often used to create one off GUI programs, using GTK, QT, FLTK, etc.

A knowledge of shell scripting can take you a long way; non compiling languages are easier to debug than compiled code like C, C++, Assembler, etc.

This may be of interest, http://www.perlmonks.org/

Last edited by fatmac; 02-23-2015 at 01:22 PM.
 
Old 02-25-2015, 04:09 PM   #9
sriram91
LQ Newbie
 
Registered: Feb 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thank you all for your valid suggesstions and for the links shared it was very helpful.
 
Old 02-25-2015, 04:13 PM   #10
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
BASH.

Python and Perl should be thought of as programming languages, and they are not used for the same things as BASH. Yes, technically they are "scripting languages", but "scripting language" this context does not mean "language used for shell scripting."

Last edited by dugan; 02-25-2015 at 06:48 PM.
 
Old 02-28-2015, 12:38 PM   #11
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
I personally try to do as much as I can in bash, because I like to have scripts with minimal dependencies. As previously said, on a Linux system you can reasonably expect to have bash available.

However, if you also want to be able to use your stuff on Windows, perl / python are easily portable, while bash is a bit more complicated...
 
  


Reply



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
[SOLVED] Python, Perl or Shell scripting? hotspur919 Linux - General 12 06-16-2011 11:39 PM
[SOLVED] Python language question: beginner shayno90 Programming 9 05-24-2011 08:18 AM
PYTHON or Bash Shell Scripting? latinmusic74 Linux - Newbie 4 06-04-2010 10:58 AM
LXer: Eclipse DLTK IDE for Perl, Python, and PHP scripting LXer Syndicated Linux News 0 02-08-2009 02:22 AM
Documents to learn C language and Perl/python satimis Programming 5 03-19-2004 10:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:03 PM.

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
Open Source Consulting | Domain Registration