Using Python to create UNIX command line tools

Discussion in 'News' started by tripwire45, Mar 20, 2008.

  1. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287

    Using Python to create UNIX command line tools



    Can you write a command line tool? Maybe you can, but can you write a really good command line tool? This articles covers making a robust command line tool in Python, complete with built-in help menus, error handling, and option handling. For some strange reason, it is not widely known that the standard library in Python has all of the tools necessary to make incredible powerful *NIX command line tools. Arguably, Python is the best language for making *NIX command line tools, period, due to its batteries-included philosophy, and its emphasis on readable code. Just a warning, though; these are dangerous ideas, when you find out how easy it is to create a command line tool in Python, you might be spoiled for life. To my knowledge, there has never been an article published in this detail on creating command line tools in Python, so I hope you enjoy it.

    My recent foray into the world of Python has spawned the posting of this news item. Find the rest at IBM's DeveloperWorks.
     
    Certifications: A+ and Network+
porta2_tags:

Comments

    1. dmarsh
      dmarsh
      Most UNIX command line tools were traditionaly written in C, C is also a fairly easy language to learn and write console apps in. Nowadays you can write them in pretty much anything you like. Admins are used to creating scripts in dynamic scripting languages rather than coding in C, but yes today I see little purpose for these non-portable, non-standard, arcane scripting languages, learn perl, python, powershell or possibly even ruby or groovy and use that instead.

      Python probably has the lead in this area as its quite well established, can be run on both unix and windows and is object orientated.

    Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.