A scripting language, learning Bash is a waste of time?

Source: Internet
Author: User
First bash, although there are if_else, can tune the system commands. But many limitations, such as not supporting multi-threading, have no libraries. So it's not necessary for PY or Ruby to learn bash again.

Reply content:

Daily work, a lot of things are very trivial and detailed, you can not imagine you will encounter any specific small task.
At this point, you can't always open vim and write a Python script.
Probably haven't finished #! yet. , the shell may have done the job.

Therefore, the shell, proficiency in various commands, will sed awk, to the daily work to bring a great efficiency improvement.
I believe that every one of the Linux under the begging of the programmer to have a deep understanding.

Trivial task one-time task to the shell; Destined to expand, the amount of code is not small, to maintain the task to be given to Python.
The work that requires efficiency is given to C. There is never a conflict. Learning Bash is not just about learning the syntax of bash itself, it's about learning how to use various command-line tools ...
In the final analysis, everything is to improve production efficiency Ah! There's a lot of stuff like the py shell and the ruby shell, and so on. On the other hand, the shell script gives you the ability to have system utility, and all the installed programs are cleaned up and lined up for you to flirt. SED, awk, kill, Cat, PS, mkdir, RM, rsync, ..... The number of people who can not count the good beautiful girl, but *nix with innate characteristics (redirection, pipe ...) It also allows them to work together well (so do one thing, good).

If your program has a lot of custom logic, and you need to target more complex data structures, the shell's clumsiness will be obvious, so go find sexy python. Use the Linux,bash or to understand. But Bash's syntax is a bit strange (usually the syntax of C is the standard syntax, so a language syntax is strange, that is, the language is far from the grammatical rules of c), so to write useful script, it is best to learn a more modern language based on C. I'm using Python now, and then I need to execute Bash's command to invoke the OS, and basically the Bash command can be run in Os.system (""). So far, the only thing I've found that I can't run with Os.system is CDs. In Python, you can use Os.chdir ("") to implement a bash CD. Today's server migration, my shell script successfully operational 500 servers, including the peer copy virtual machine configuration by IP modification, component start-stop, log backup, server operation status monitoring. The shell does not need a Python interpreter at least, the code is unusually elegant, you feel the shell is uncomfortable, or are constrained by the traditional command-style programming framework. Every time I open vim to see the colorful and very concise shell is intoxicating, who the mother let me write Java or Python to do operations, I'm with whom I'm anxious. If you are writing scripts that require long-term operations, it is highly recommended to use Python (or ruby, etc.), not to say that it will be faster and more convenient, It's readable and maintainable, and like makefile, the weird syntax and symbols in bash, sed, awk, and make are really not as expensive as python, and Python is a great way to kill most needs. Or your brain has to switch back and forth between Bash,sed,awk.
But if your script might just run one time, or a temporary command, bash is still handy
So, bash does not have to be very proficient, but to ensure that it will go to a certain level, daily work to differentiate to do
However, you will inevitably encounter the reading maintenance of other people's Code, so it is generally necessary to understand the next, such as if the syntax, as for if the-a-o-F and so on can ask the Niang of course is not a waste of time (otherwise you let us this will use the shell of the situation why it is ...)

Suppose there's a piece of crap on the road, do you shovel it with a shovel (shell), or open a forklift (python)?
Of course, there will be pits, but most of the way is lying on the road a piece of excrement, it is very likely that others have been thrown over.

And the shell is not that disgusting. The real script. Debug the program under the *nix server, view the program debug log or run the log, and if you don't know the shell, your bash and command line are poorly designed. But the situation is so, you can not learn to go.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.