Skip to contentSkip to conversation

feeding a script from standard input

DISCUSSION Jeffrey Holle 3 participants 5 messages Jan 27, 2004 – Jan 30, 2004

lore
Share & tools
lore
#0 lore raw

I have a script, call it genpyste that looks like this:

	#!/bin/sh
	pyste --out=. --multiple --module=mymodule Parameter.pyste

The problem with it is that this is just a start of it.
When I'm done, there will need to be about 30 parameters like Parameter.pyste.

I'm wondering if I can do something like this from the command line:

ls *.pyste | ./genpyste

What, if anything, can be done to the genpyste script to work like this?

#1 lore raw

On Mon, 2004-01-26 22:04:16 -0800, Jeffrey Holle <[email protected]> wrote in message <[email protected]>:

Quoted 9 lines

I have a script, call it genpyste that looks like this:

	#!/bin/sh
	pyste --out=. --multiple --module=mymodule Parameter.pyste

The problem with it is that this is just a start of it. When I'm done, there will need to be about 30 parameters like Parameter.pyste.

Quoted 5 lines

I'm wondering if I can do something like this from the command line:

ls *.pyste | ./genpyste

What, if anything, can be done to the genpyste script to work like this?

Why not make it like this:

#!/bin/sh
pyste --out=. --multiple --module=mymodule "$*"

and then call it like

$ ./genpystr *.pyste

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#2 lore raw

Thanks for this, works without the quotes!

Quoted 28 lines · Jan-Benedict Glaw

On Mon, 2004-01-26 22:04:16 -0800, Jeffrey Holle <[email protected]> wrote in message <[email protected]>:

Quoted 5 lines

I have a script, call it genpyste that looks like this:

	#!/bin/sh
	pyste --out=. --multiple --module=mymodule Parameter.pyste
Quoted 8 lines

The problem with it is that this is just a start of it.
When I'm done, there will need to be about 30 parameters like Parameter.pyste.

I'm wondering if I can do something like this from the command line:

ls *.pyste | ./genpyste

What, if anything, can be done to the genpyste script to work like this?

Why not make it like this:

#!/bin/sh
pyste --out=. --multiple --module=mymodule "$*"

and then call it like

$ ./genpystr *.pyste

MfG, JBG

#3 lore raw
Quoted 1 line · Jeffrey Holle

Thanks for this, works without the quotes!

Better to use "$@".

Otherwise if you do something like *.foo and any of those names has spaces in it, it would fail. Only "$@" will get that case right.

Even the people who designed that feature call it magic.

mrc

Signature · 3 lines
     Mike Castle      [email protected]      www.netcom.com/~dalgoda/
    We are all of us living in the shadow of Manhattan.  -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
#4 lore raw

On Wed, 2004-01-28 23:30:16 -0800, Mike Castle <[email protected]> wrote in message <[email protected]>:

Quoted 4 lines · Jeffrey Holle
Quoted 1 line

Thanks for this, works without the quotes!

Better to use "$@".

That was actually ment - sorry for confusion.

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));