[SOLVED] Best Scripting Language for beginner : Bash vs Python vs Perl
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ...
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:
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...)
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.
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.
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,493
Rep:
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.
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."
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...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.