f



Python vs Unix shells

This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=8964/sam0312a/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.
0
paddy3118
12/13/2003 10:13:40 AM
comp.unix.shell 15484 articles. 2 followers. Post Follow

4 Replies
411 Views

Similar Articles

[PageSpeed] 11

In <comp.lang.python> Paddy McCarthy <paddy3118@netscape.net> wrote:
> This is really a comment on "Python in Systems Administration: Part I
> -- Better Scripting"
> http://www.samag.com/documents/s=8964/sam0312a/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, <opengeometry@yahoo.ca>
Linux solution for data management and processing. 
0
opengeometry (485)
12/13/2003 9:50:40 PM
William Park <opengeometry@yahoo.ca> wrote in message news:<brg1jf$2v6cj$1@ID-99293.news.uni-berlin.de>...
> In <comp.lang.python> Paddy McCarthy <paddy3118@netscape.net> wrote:
> > This is really a comment on "Python in Systems Administration: Part I
> > -- Better Scripting"
> > http://www.samag.com/documents/s=8964/sam0312a/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.
0
paddy3118 (377)
12/14/2003 11:16:37 AM
In article <2ae25c6b.0312140316.77f7059f@posting.google.com>,
Paddy McCarthy <paddy3118@netscape.net> wrote:
			.
			.
			.
>> > This is really a comment on "Python in Systems Administration: Part I
>> > -- Better Scripting"
>> > http://www.samag.com/documents/s=8964/sam0312a/0312a.htm
>> > by Cameron Laird.
			.
			.
			.
>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.
			.
			.
			.
As I read your comments, you do a good job of answering all
the questions yourself.  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.

Your posts challenge me, but in a good way.  I do want to
say that one of my favorite signs of health in Pythoneering
is the tradition of using the "if __name__ == '__main__':..."
idiom to compose source which is both importable and
executable.

So:  can I enlist you to review my drafts?
-- 

Cameron Laird <claird@phaseit.net>
Business:  http://www.Phaseit.net
0
claird429 (924)
12/15/2003 2:37:50 PM
In article <vtrhpu26nohvae@corp.supernews.com>,
 claird@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, donn@u.washington.edu
0
Donn
12/15/2003 5:41:24 PM
Reply:

Similar Artilces:

web hosting, shell provider, unix shells, bnc shell, ircd provider, shell hosting, bnc shells, irc shells, ircd shells, unix shell account, irc shell, irc, eggdrop shell, irc vps, irc shell, linux vps
http://www.hostrazor.net/ web hosting, shell provider, unix shells, bnc shell, ircd provider, shell hosting, bnc shells, irc shells, ircd shells, unix shell account, irc shell, irc, eggdrop shell, irc vps, irc shell, linux vps -- questo articolo e` stato inviato via web dal servizio gratuito http://www.newsland.it/news segnala gli abusi ad abuse@newsland.it ...

UNIX shell in Python?
Hello. I was thinking about writing a UNIX shell program using Python. Has anyone got any experience on this? Is it even possible? I have programmed a simple shell in C before and I came to think about how perfect Python would be for parsing user input. Regards, Deniz Dogan Deniz Dogan wrote: > Hello. > > I was thinking about writing a UNIX shell program using Python. Has > anyone got any experience on this? Is it even possible? I have > programmed a simple shell in C before and I came to think about how > perfect Python would be for parsing user input. > &g...

can I run unix shell command in the ModelSim shell?
Hi, Just wonder if I can run unix shell command in the Modelsim shell, expecially those time/date command? Thanks. clinton__bill@hotmail.com wrote: > Hi, > Just wonder if I can run unix shell command in the Modelsim shell, > expecially those time/date command? ModelSim uses Tcl as its scripting language so (almost) anything you can do from Tcl can be done in ModelSim. Tcl has a variety of shell and file interaction commands available. Of course, if you want to execute Unix commands, you need to be running on a Unix (or Cygwin) system. Note that Tcl commands are NOT direct...

How to create a unix shell account with Python?
Hi! I couldn't find anything on creating a new linux user account in Python documentation. Anyone has any experience with this? You just run useradd command in shell or is there a more pythonic way? Thanks, Sebastjan os.system("useradd ...") Its not pretty, but it gets it done. Ok, thanks :) On 5 Feb 2006 13:01:23 -0800, brent.chambers@gmail.com <brent.chambers@gmail.com> wrote: > os.system("useradd ...") > > Its not pretty, but it gets it done. > > -- > http://mail.python.org/mailman/listinfo/python-list > ...

Shell shell
hello could anyone help me with such problem I would like to have the class in which I will prepare new window to display.. I want to do it as a shell.... How could I return created shell from that class?? many thanks "uzi" <wojciech.ulasW_ytn_I_JTO@op.pl> wrote in message news:dlih8c$1qm$1@news.onet.pl... > hello > > could anyone help me with such problem > > I would like to have the class in which I will prepare new window to > display.. > I want to do it as a shell.... > > How could I return created shell from that class?? "Sh...

Unix Shell
Hello In my linux boot menu i have 2 kernel options, i would like to delete one, how can i do that "daniel" <maconpunta@yahoo.com> writes: > In my linux boot menu i have 2 kernel options, i would like to delete > one, how can i do that This is not a good idea. It's better to keep several kernels, to have some backup options in case the default one doesn't work (either because it's been updated with a bad one, or because it's been damaged on the disk, etc). The best is to have two or more different kernel options, all working. Remove only the kernels t...

lisp repl vs unix shell
there's a post about sbcl 1.0 on reddit http://programming.reddit.com/info/t1cf/comments and some guy in comments mentioned that he dislikes SBCL for not as usable with Unix shell as CLISP is. i've told them that: AM>unix sucks lisp rules. who ever wants unix shell if he has lisp prompt? and was being downmodded for that. ang guy replying: Someone who doesn't want to use stuff like (with-output-to-file ("foo.txt" :direction :output :if-exists :supersede) ...)" when it's possible to use "... >foo.txt". got upmodded, having such a stupid p...

Unix Shell
I'm new to RUBY, but am familar with other scripting languages, PHP, Perl, Wscript, etc. I'd like to be able to run items from the shell such as ls -l > dirlisting.txt. Just an example. Can I do this? I would have just used the search on these forums, but unfortuantely when I click Search I get "The page cannot be found". Hope they can get this fixed so I won't have to ask every little question. Thanks in advance. -Greg -- Posted via http://www.ruby-forum.com/. Greg Johnson wrote: > I'd like to be able to run items from the shell > such as l...

unix shells
I have compiled a program called mk, and it's internal routines work with unixlib in a taskwindow happily enough. However the wheels fall off when a recipe wants to 'fire up' a child process for calling the gcc commands. It's a little confusing, because it echos the command perfectly to it's running Taskwindow, but errors with mk fork Invalid argument Looking inside a bit further, I think the error comes from a program unix.c where there also is reference to /bin/sh Should I be trying to map this to a new Taskwindow with Set UnixFS$/bin/sh Taskwindow or some redirection...

Unix shell
Hi all, We offer free shells with web hosting and a spam-filtered email account. - 50MB storage space (more available upon request) - Domain hosting available upon request - Access via SSH, SFTP, and POP3-ssl - Instant messaging clients for IRC, AIM, MSN, ICQ, Yahoo!, Gadu-Gadu, Jabber, and Lily - FastTrack (KaZaA), SoulSeek, and BitTorrent clients - Optional trainable server-side spam detection is also included. We also have a few vhosts for fans of IRC. Instant accounts available at: http://silenceisdefeat.org/ Anyway, I hope this is an acceptable place to let you guys know. If i...

About UNIX shell trap, any relative function in Python ?
Hi All Machine : AIX 5.3 Python : 2.6.2 In UNIX have, trap to run defined CLEAN_UP function. When HUP INT KILL STOP TERM will run CLEAN_UP function. trap 'echo "\n\nProcessing Clean up"; CLEAN_UP; exit' HUP INT KILL STOP TERM Any relative function in Python ? moonhkt On Sun, Dec 16, 2012 at 2:34 AM, moonhkt <moonhkt@gmail.com> wrote: > > Hi All > > Machine : AIX 5.3 > Python : 2.6.2 > > In UNIX have, trap to run defined CLEAN_UP function. When HUP INT > KILL STOP TERM will run CLEAN_UP function. > > trap &#...

Bash shell to Python shell?
I am sure you have not read a question this basic in some time, but I am curious. Using Linux I open a terminal window and type: python. Does Bash Shell go away and to become a Python Shell, or is it still a Bash Shell with Python running inside? Thanks in advance. On Sun, Sep 27, 2009 at 8:13 PM, edwithad <edwithad@hotmail.com> wrote: > I am sure you have not read a question this basic in some time, but I am > curious. Using Linux I open a terminal window and type: python. > > Does Bash Shell go away and to become a Python Shell, or is it still a Bash > Shell with Py...

US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335832409)
US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335832409) ============================================================================================= Position: UNIX Developer Reference: SMC01885 Location: Jersey City NJ Duration: 7M Skills: Knowledge of SwiftAlliance Access. Exp in upgrading/migrating Swift Alliance Access, Swift Alliance Gateway, SwiftNet Link. Knowledge of Compliance and Watchlist filtering applications like Mircosoft. Knowledge of Banking, payme...

US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335553540)
US-NJ-Jersey City: UNIX Developer, UNIX, Shell scripting, SwiftAlliance Access; (45335553540) ============================================================================================= Position: UNIX Developer Reference: SMC01885 Location: Jersey City NJ Duration: 7M Skills: Knowledge of SwiftAlliance Access. Exp in upgrading/migrating Swift Alliance Access, Swift Alliance Gateway, SwiftNet Link. Knowledge of Compliance and Watchlist filtering applications like Mircosoft. Knowledge of B...

Web resources about - Python vs Unix shells - comp.unix.shell

Python - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Buster the puppy lucky to be alive after tussle with python on Sunshine Coast
A puppy named Buster is lucky to be alive after a python latched on to its jaw and tried to strangle the dog to death.

On the hunt to get rid of Florida's invasive pythons - Videos - CBS News
The hunt is on in the Florida Everglades for Burmese pythons, an out-of-control snake species. They’re not venomous, but they are big, strong ...

Florida issues 'Python Challenge' to combat invasive snake - CNN.com
The Burmese python, one of the largest snakes in the world, is running amok in Florida.

Man Caught On Camera In Pet Store Shoving Python Down Pants
... his pants . Last week in Portland, OR, a pet store’s surveillance cameras caught a man on camera who used this method to conceal a pricey python ...

Resources last updated: 2/12/2016 8:59:50 PM