Jump To Content

LearnHub



Shell scripts (Discussion)

JohnPhilipGreen saidTue, 15 Jan 2008 22:04:08 -0000 ( Link )

How do you pick which language to use for shell scripts? Ruby, perl, bash… is one a better choice for certain tasks, or does it just come down to which you like better?

Actions
Vote
Current Rating
0
Rate Up
Rate Down
No Votes
  1. aliasaria saidFri, 07 Mar 2008 16:17:48 -0000 ( Link )

    We’ve used so many where I work..

    It is helpful to only use one language for all shell scripts—so you don’t have tons of code that can’t work together.

    At one point, we used the same language for scripts that we were using for our web dev—so we could share libraries and not have to rewrite them in the scripting language.

    In the end, this didn’t work well because PHP (and RUBY also) were not designed for shell scripting.

    Soooo…..

    The engineering decision would be based on some of the following criteria:

    • Will you be able to use it with your existing code
    • Was it designed for the shell?
    • Is it a nice language? (e.g. Perl is ugly)
    • Is there a lot of open-source code available for this language?

    My opinion: Python is your best choice.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  2. agoucher saidTue, 11 Mar 2008 01:59:17 -0000 ( Link )

    Since most scripting languages these days are able to do rapid, cross-platform development I find it more useful to work backwards and eliminate other languages.

    Perl - not intuitive to learn - has a legacy of being difficult to maintain - community is split between v5 and v6 (this will likely be an issue for Python as well after 3.0)

    Ruby - lack of unicode support in the base (though that is changing soon if not already) - lack of real momentum for anything other than rails.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  3. amanuel saidWed, 12 Mar 2008 17:28:55 -0000 ( Link )

    3 criteria.

    1. Is it suitable for the task? factors: speed, complexity of code.
    2. Where will I use it? What is the likelihood that it is available on different machines?
    3. Maintainability….will I have to revisit the code or is it a ‘one-off’ ?

    For me:
    sh/bash for simple iterative file manip.
    perl/ruby for regex/text manip. (perl if regex is very complex or need it on different machines)
    ruby for extensible or if oop is needed.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  4. karthiktech123 saidFri, 09 May 2008 11:33:11 -0000 ( Link )

    I agree with amanuel…

    If the task involves issuing lot of OS related commands then bash/or any other shell script will do… Perl is so powerful, when it comes to regexs. But it has so many other intended purposes like effective CGI programs etc.,Ruby is relatively new & yet evolving dynamic script based OOP.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

Your Response
Textile is Enabled (View Reference)