-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/07 19:08, Bob McGowan wrote: > Douglas Allan Tutty wrote: >> On Wed, May 09, 2007 at 09:00:58AM -0700, Bob McGowan wrote: >>> bdeferme wrote: >>>> Tom Grove <[EMAIL PROTECTED]> wrote: >>>> >>>>> Hello all...I am new to this Debian thing :-) I used it in the Woody >>>>> days but moved over to the FreeBSD world for the last few years. I >>>>> recently installed Testing (Lenny) and see the left bracket in my >>>>> /usr/bin directory and do not know what it is. When I ls -al it I >>>>> get: > > <---deleted content---> > >>> dpkg -S '/usr/bin\[' >>> >>> is much easier to read (and type correctly), than >>> >>> dpkg -S /usr/bin/\\\[ >>> >> >> No wonder I can never figure out what a shell script is trying to do, >> either way it looks like a cat on a keyboard. Give me python and >> fortran77 any day. >> >> Doug. >> > > As I don't use python, I have no direct experience here. I do use Perl, > however. It is also 'easier' than the shell, assuming you put the > script in a file. > > So, a question: Can python 'run' code directly from the command line, > as Perl does with the -e option? > > perl -e 'while(<>){print}'
Short snippets, since Python relies on newlines and whitespace so much. > for example. If so, you'd have the same quoting issues you have with a > shell script, since you would need to protect the python part of the > input from shell interpretation. > > Since the shell is both a command interpreter (runs other applications) > and a programming language, it gets very complicated when it is working > with another program that also uses wild cards or regex or simply > general programming language constructs like parens or braces. > > Putting things in a file makes things even easier, assuming the program > in question will read files (as Perl, python, awk, C, Fortran, Pascal > ..., do). Unfortunately, this doesn't help a lot with the shell, the > same problems exist in the shell script file as exist on the command line. Or a pseudofile. Here's a simple example: python << EOF import time print time.time() EOF - -- Ron Johnson, Jr. Jefferson LA USA Give a man a fish, and he eats for a day. Hit him with a fish, and he goes away for good! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGQmxFS9HxQb37XmcRAsjVAJ9ZCKAo94sfaebn2ABQeKMTIzme3gCg7gYb GTREhVNsDOwbFzm1m5cO760= =wl70 -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]