I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with Perl, but in my Linux certificate class, I got introduced to Perl programming. But, I am wondering if I would be able to do everything I want to do with Perl in a Unix environment, or if for something I would have to know shell to get them done?
Can you please advise? Administrator Emeritus. Join Date: Aug You should probably learn both. Shell scripting is easier to learn and can do lots of stuff. It takes longer to learn Perl but Perl can do everything that can be done via shell scripting and lots of stuff that would very hard or even impossible with a shell script.
I suggest you learn shell scripting first then learn Perl. I personally would not hire anyone who could not write basic scripts. In the interest of full disclosure, some people call me "old school". That was good advice and I really appreciate it.
Web Development. If you know yourself and you know you have a brain, don't be scared off by bash. If you're a basic thinker, maybe stick to something like Python. To each their own. As rule of thumbs, use the simplest language that has good enough performance for your task at hand.
And its particularities only to the extend they are truly useful. And about readability, Bash is horrible if your programming style is horrible. If you just throw code over there, it becomes obscure.
But if you split code into the shortest functions , and name things in a simple understandable manner, it's the clearest language you can find. Because it's very terse. Perl is easy, nearly unlimited, mostly fast, and kind of ugly. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. Asked 9 years, 6 months ago. Active 2 years, 7 months ago. Viewed 95k times. Improve this question. If you can do it using either, does it really matter? The choice is only interesting if the resulting script presents any differences. For example, execution time could differ drastically not the case an issue when email accounts.
Add a comment. Active Oldest Votes. Improve this answer. I've got quite some experience with bash scripting, as with Ruby, but I sometimes still don't know what to use. Choosing based on personal preference at that moment in time seems silly. But you're right, I'll ask myself what I want to do and pick the best tool for the job. Personally, I'll use a scale of the languages I know well, in ascending order of complexity and power, and use the simplest that will fit the bill.
But really, the only way to know for sure is writing your script in all languages and comparing the outcome. It's all more of a gut feeling than a certainity. After some years writing scripts, you will have come across most "types of problems", and know which language did well solving them.
Just wanted to add that using small programs in the GNU coreutils package like tr, sort, uniq and piping them it's possible to accomplish a lot of tasks. TL;DR - use bash only for installing a better language if it isn't already available , otherwise you're wasting unrecoverable, precious human time.
Cezary Baginski Cezary Baginski 5 5 silver badges 4 4 bronze badges. While Perl code can be messy, featuring many paths to accomplish the same goal, Python is clean and streamlined.
Originally, it took Still Perl is much faster. Python was never intended to replace Perl. Perl was designed to extract stuff from text files.
Python was designed as a scripting language for system programming. Machine language, or machine code, consists of binary code and is the only language that is directly understood by the computer. Both machine code and assembly languages are hardware specific.
A high-level language is a programming language that uses English and mathematical symbols in its instructions. People mainly say they hate Perl because it can be very hard to read. Originally Answered: Why is Perl dying? Perl is still very much a viable choice for modern programming.
That command in the bash script gets run no matter what. Normal exit, error exit, explosion, Ctrl-C, core dump Not so in Perl. Finally that was fixed, making it easier. The bash version is just cleaner. Tilde Expansion I know, I know Conditionals in shell scripts can be wonky.
Quoting in shell scripts can be a nightmare. Arrays in bash suck. Hashes in bash assuming your bash is new enough to have them at all suck even harder. Once processing files or command output goes beyond the simple case I listed above, Perl starts really smoking bash. Your other blog wouldn't let me comment, but I would have written: Or you could use zsh and get the best of both worlds. Hercynium April 16, PM Reply. Thanks for all the comments guys!
You can always use parseopt from git for shell Thanks Buddy. Leave a comment. Email Address. Remember personal info? About Buddy Burden 13 years in California, 24 years in Perl, 33 years in computers, 54 years in bare feet.
More info ». Search this blog Search.
0コメント