Thread View: comp.unix.shell
3 messages
3 total messages
Started by Georg Wittig
Thu, 13 Sep 1990 12:46
execute stdin ?
Author: Georg Wittig
Date: Thu, 13 Sep 1990 12:46
Date: Thu, 13 Sep 1990 12:46
18 lines
988 bytes
988 bytes
Is it possible (in sh or in csh) to execute a program that is read from stdin? For example, if the program ``myprog'' is in compressed format, it isn't nice to type uncompress myprog.Z ; myprog params_of_myprog ; compress myprog Rather, it would be nice to be able to write something like zcat myprog.Z | execute_stdin params_of_myprog or `zcat myprog.Z` params_of_myprog or ??? Any ideas? Thanks in advance -- Georg Wittig GMD-Z1.IT | wittig@gmdzi.gmd.de | "Freedom's just another word P.O. Box 1240 | wittig@zi.gmd.dbp.de | for nothing left to lose" D-5205 St. Augustin 1 | | (Kris Kristofferson) West Germany | (+49) 2241 14-2294 |
Re: execute stdin ?
Author: Guy Harris
Date: Sat, 15 Sep 1990 18:36
Date: Sat, 15 Sep 1990 18:36
13 lines
890 bytes
890 bytes
>Is it possible (in sh or in csh) to execute a program that is read from >stdin? It's possible, although the ways you can do it depend on whether the "program" is an executable image or a script. If it's a script, you can try piping it to the interpreter (shell or whatever). If it's an executable image, in most UNIXes you must either put it into a file, or construct some program that reads its standard input and sets up its address space to contain the executable image it's reading and then jumps to it.
Re: execute stdin ?
Author: Joe Smith
Date: Thu, 27 Sep 1990 00:00
Date: Thu, 27 Sep 1990 00:00
13 lines
1030 bytes
1030 bytes
In article <3335@gmdzi.gmd.de> wittig@gmdzi.gmd.de (Georg Wittig) writes:
>Is it possible (in sh or in csh) to execute a program that is read from stdin?
Yes, use the "-s" option to sh. For example:
(echo 'ls -l $1'; echo 'wc $1') | sh -s /etc/motd
As simple as that.
--
Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41 | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads