On 05/16/2012 08:16 PM, Rita wrote: > I currently build a lot of interfaces/wrappers to other applications > using bash/shell. One short coming for it is it lacks a good method > to handle arguments so I switched to python a while ago to use > 'argparse' module.
Actually there is a great way of parsing command line options in bash, using the GNU "getopt" program. See: http://www.manpagez.com/man/1/getopt/ This command is available on all Linux systems, and most BSD systems. There's also freegetopt, a BSD implementation for unix, MSDOS, or Windows. > Its a great complement to subprocess module. I was wondering if there > is a generic framework people follow to build python scripts which > are replacing shell scripts? Is there a guide or a template to > follow? Besides the advice given by the other posters in this thread, here is a very good document on some unique aspects of python that are well suited to doing system programming or shell scripting in python: http://www.dabeaz.com/generators/ This describes how generators can be used to replace pipes with something that is quite efficient and very pythonic. See the presentation pdf first. -- http://mail.python.org/mailman/listinfo/python-list