Find the answer to your Linux question:
Results 1 to 7 of 7
Hello Linux gurus and the rest of you pleasant folks. I've only taken basic computer science classes, and am a scientist by profession. I fell in love with Unix-based command ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2013
    Posts
    19

    Does BASH Make you Stupid?? For a learning programmer...


    Hello Linux gurus and the rest of you pleasant folks.

    I've only taken basic computer science classes, and am a scientist by profession. I fell in love with Unix-based command lines when I was introduced to the pipe. Everything changed since then. I REFUSE to manually analyze and organize my results anymore. Everything must be done repeatably and with a single keystroke. I started picking up bash scripting from the internet, and just couldn't let go.

    I consulted some manuals and went online, and what I learned was disturbing. They said that novice programmers would be at a major disadvantage if they learned BASH first, that they would pick up "bad habits" and not fully appreciate the fundamentals of computing needed to make reliable, efficient programs.

    For those of you who read my previous posts, I've been hard at work making a program to analyze parsed laboratory data -- a very grep/sed/awk heavy project.

    I can complete this program in a few months time, I think, with all of the parameters and options I need to make it a useful tool for fellow scientists. That would be my dream! But I'm torn, because by that time, the bad habits of BASH might have solidified in my mind. The next software solution I need may be better off written in Python (most scripts used in genetics, my field, appear to be). I don't want to have to unlearn a bunch of BASH stuff, and make the learning curve even harder for myself when the time comes around.

    So for you wise old programmers, what do you suggest?

    1) BASH doesn't make you stupid. Finish your program in BASH and learn Python if(f) you receive a new project that calls for it.

    2) BASH kinda makes you stupid. Quickly finish your project without all of the features you planned, and start learning Python.

    3) BASH makes you completely stupid! Learn Python immediately and don't write a single additional line of code for your BASH program.

  2. #2
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    129
    I am by no means a wise old programmer but I have sampled many languages. That being said I would say without context that article can be both valid and invalid as there are many "branches" of programming. However my best assumption of what that article was saying is bash is a weakly typed language being it can do implicate type conversions and it lacks any object oriented features. However for text processing and smaller scripts bash is an excellent beginners language that is powerful and doubles as the defacto login shell for many unix and linux distributions.

    That being said I personally would opt for your second choice. Python is a large language with a great many many libraries and some functions hand written in bash could be predefined library functions in python. Also python has the Python Packaging Index or PyPI a user submitted repository of useful modules. Also you will not need to "unlearn" anything just adjust to the newer syntax and expanded features.

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,356
    I second that.
    Imho, there is need and usecases for both shell scripts and perl/python/ruby/etc

    One *can* code some pretty nice tools and scripts in bash.
    And as it is available everywhere (at least on linux) this knowledge is useable.
    Bash is also nice to prototype a solution or glue tools together.

    However, for everything "bigger" or project-like, I tend to use ruby (please replace ruby with the language of your choice).
    The readability is better, a lot of problems have already been solved and made into gems, it is a strongly typed language, there are IDEs, etc etc


    Other than that:
    Back in my days at university, C was also a common tool.
    Harder to learn and master, but much faster for processing tasks.
    You must always face the curtain with a bow.

  4. #4
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    129
    Yeah that is true C is also a ubiquitous and incredibly powerful language but for a beginner I would not recommend it.

  5. #5
    Just Joined!
    Join Date
    Feb 2013
    Posts
    19
    Quote Originally Posted by Irithori View Post
    I second that.
    Imho, there is need and usecases for both shell scripts and perl/python/ruby/etc

    One *can* code some pretty nice tools and scripts in bash.
    And as it is available everywhere (at least on linux) this knowledge is useable.
    Bash is also nice to prototype a solution or glue tools together.

    However, for everything "bigger" or project-like, I tend to use ruby (please replace ruby with the language of your choice).
    The readability is better, a lot of problems have already been solved and made into gems, it is a strongly typed language, there are IDEs, etc etc


    Other than that:
    Back in my days at university, C was also a common tool.
    Harder to learn and master, but much faster for processing tasks.
    Hey, thanks to you and Alpha90 for your input.

    Irithori, my intuition tells me that what I did in BASH could have been done similarly in Python. I would like to continue to make more advanced features, now taking advantage of the Python library.

    I read that Python can be used as a glue between multiple languages. It's messy, but can I "swallow up" the project with Python (pun intended) and keep the original scripts in the new program? I do the same thing in BASH pretty much (I think) when I call awk and write script in that, right?

    If you need more detail, and you have the time/inclination, I'd like to share it with you more completely.

  6. #6
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    129
    Sure Deuteros I would like to see your project.

    Yes generally what can be made in one programming language can be made in another. There are tradeoffs to be made when choosing a language and some languages are less able to deal with certain problems and functions as others. You are correct again in your conclusion that python could be used as an advanced wrapper around your existing BASH scripts in fact python excels at calling exterior program functions compared to some of the compiled languages.

  7. #7
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,356
    To add:
    Every language can execute binaries in one or the other way.
    A bash script more or less consists of that (safe for the internal commands)

    However, in the case of python (and ruby/perl/etc) for consistency, data management, performance, methods- and code reuse purposes it is recommended to stay within one language.
    ie: Do not call an external wget, but instead get an url via python methods.
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •