472,363 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

Python vs Unix shells

This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=896...312a/0312a.htm
by Cameron Laird.

Reading the article, although I am a fan of Python, I kinda take issue
with the example given. It doesn't seem to fit with the concept of
'many smaller utilities doing one thing well, connected via pipes'

If I had the task of writing a Unix utility to match the GUI Python
example I would prefer to either:
1) save a sorted file listing to a temporary file then use either
$EDITOR or vi to edit the temporary file, and on completion extract
those files mentioned in the temporary file. OR
2) Write a general argument selector in Python that could be imported
in a larger Python prog as a module where its function would be to
display a python list of strings in a GUI and return those selected,
OR when executed as a command, it would display all its arguments in
the order given, and return those selected. The command line versions
could have options to sort the input and to either return space
separated or newline separated versions of its output (and maybe CSV
too).

The advantages of the first is that you would use the users $EDITOR.
The user will be on familiar territory, and not much extra programming
is needed.

The advantages of 2 are that you end up with a python module/script
that is *re-usable* both in a Python program and as a command line
script in the tradition of Unix utilities.
Such Python module/scripts if collected on a central web site could
form a useful resource for System Administrators.

Whoops, I almost forgot, The third way might be to look up utilities
for adding GUIs to command line utilities and using those. (e.g.
kaptain at http://kaptain.sourceforge.net )

To summarize then, using similar reasons for writing a script for the
simple tar extraction; when you write your Python version you might
want to modularize reusable components but also make that Python
module a command line utility itself.

Cheers, Pad.
Jul 18 '05 #1
4 1618
In <comp.lang.python> Paddy McCarthy <pa*******@netscape.net> wrote:
This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=896...312a/0312a.htm
by Cameron Laird.

Reading the article, although I am a fan of Python, I kinda take issue
with the example given. It doesn't seem to fit with the concept of
'many smaller utilities doing one thing well, connected via pipes'


What did you expect from a Python consultant? He has the right to make
a living and advertise his expertise.

--
William Park, Open Geometry Consulting, <op**********@yahoo.ca>
Linux solution for data management and processing.
Jul 18 '05 #2
William Park <op**********@yahoo.ca> wrote in message news:<br************@ID-99293.news.uni-berlin.de>...
In <comp.lang.python> Paddy McCarthy <pa*******@netscape.net> wrote:
This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=896...312a/0312a.htm
by Cameron Laird.

Reading the article, although I am a fan of Python, I kinda take issue
with the example given. It doesn't seem to fit with the concept of
'many smaller utilities doing one thing well, connected via pipes'


What did you expect from a Python consultant? He has the right to make
a living and advertise his expertise.


Hi William,
I don't understand why you made your comment?
I was expecting replies of maybe "the pressures of getting an example
to fit the article made his example maybe a little artificial" (but
still useful). or people agreeing or disagreeing with the idea of
modules that are also Unix scripts.
I can't see how Cameron being a consultant has anything to do with it.

Cheers, Paddy.
Jul 18 '05 #3
In article <2a**************************@posting.google.com >,
Paddy McCarthy <pa*******@netscape.net> wrote:
Jul 18 '05 #4
In article <vt************@corp.supernews.com>,
cl****@lairds.com (Cameron Laird) wrote:
... In other articles, I've said a few
words about the difficulty of writing good examples for an
audience of systems administrators; I do find it hard not
being "maybe a little artificial" (I appreciate your gentle
touch), without complexification that loses the reader.


Maybe the category is a little artificial, in that system
administration isn't really a computer programming domain
like numeric, hardware control, rendering, web publishing.

I suppose that's part of your point, when you talk about
writing your own tools rather than buying packaged solutions.
Not many good packaged solutions for Miscellaneous Little Tasks.

Donn Cave, do**@u.washington.edu
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ralph Freshour | last post by:
I have a PHP web app using MySQL - when I save a .jpg file named test's.jpg I see that the filename on the unix server is: test\'s.jpg - the filename I end up saving in my SQL table is named...
13
by: Eric Pederson | last post by:
Raise your hand if you think the best technology wins! For those of you with your hands in the air, tell me: if Python is so good,why has PHP achieved such greater adoption and mindshare? Why...
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
0
by: Xah Lee | last post by:
One-Liner Loop in Functional Style Xah Lee, 200510 Today we show a example of a loop done as a one-liner of Functional Programing style. Suppose you have a list of file full paths of...
22
by: Ryan M | last post by:
I've been programming for a while, but most of my experience is on unix. How do C compilers work on operating systems that weren't written in C? And that have no libc? Compiling C on unix seems...
9
by: Adriano Ferreira | last post by:
Many Python scripts I see start with the shebang line #!/usr/bin/env python What is the difference from using just #!python Regards, Adriano.
14
by: Kenneth McDonald | last post by:
At the moment I'm doing most of my stuff on a Mac, but I've been considering also getting a Windows laptop. One of the reasons is that I've found it very difficult to get certain Python related...
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for...
0
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.