home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cbmvax!andy
- From: andy@cbmvax.commodore.com (Andy Finkel)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Help me with Shell scripts (AmigaDos or sksh)
- Message-ID: <37763@cbmvax.commodore.com>
- Date: 10 Dec 92 05:39:32 GMT
- References: <37679@cbmvax.commodore.com> <Bz0FI6.Eut@fc.hp.com>
- Reply-To: andy@cbmvax.commodore.com (Andy Finkel)
- Organization: Flying Cat, Inc.
- Lines: 54
-
- In article <Bz0FI6.Eut@fc.hp.com> koren@fc.hp.com (Steve Koren) writes:
- >Andy Finkel (andy@cbmvax.commodore.com) wrote:
- >
- >> >> cat >pipe:files
- >> >> more <pipe:files
- >
- >> Actually, the example he gives works exactly as he states. (this with
- >> More 37.4, from the 2.04 Release). More does some sniffing to figure
- >
- >I can get this to work _if and only if_ it is not in a script, as the
- >original poster mentioned he wanted. With the AmigaDos CLI under OS
-
- Because of the commands (cat) I assumed he was talking about
- a script other than an AmigaDOS Execute command script; Standard
- AmigaDOS scripts work by redirecting stdin and hooking it to the
- file containing the script. That's why command line redirection
- of a script file doesn't do much good. There are other ways to implement
- scripts without that limitation.
-
- >As for the System()/more problem (ie, more doesn't like its stdin
- >redirected from a PIPE: file when called from System()), it seems that
- >only affects more. Under OS 3.0, Ray Zarling's "less", and "most" from
-
- That's because More is doing sniffing to see what it is connected to.
- I'd have to see that section of Sksh code to tell what is going on;
- obviously More is making the wrong decision somewhere; whether this
- is because of something Sksh isn't setting up, or something More is
- doing incorrectly, I can't tell (from here :-) )
-
- > but not
- > fgrep mystring myfile | more
- >
- >What happens in this case is that sksh executes "fgrep" with a
- >SYS_Output pointing to something like "PIPE:_temp1" and SYS_Async set.
- >Then it runs "less" or "most" or "more" with SYS_Input set to
- >"PIPE:_temp1" to read the input from the pipe. Given that I cannot use
-
- I'd have to see your code; I did something similar in my PIPE
- command, which gives command line pipes to the standard shell.
- The PIPE command handles all the cases you list properly, and uses
- the System() call, so I assure you, it can be done :-)
- (the PIPE command, along with some other hacks for the 2.04 shell,
- is on a Fish disk, and on some of the archives)
-
- > - steve
-
- andy
- --
- andy finkel andy@cbmvax.commodore.com
-
- "Unix is the Operating System of the future, and always will be."
-
- Any expressed opinions are mine; but feel free to share.
- I disclaim all responsibilities, all shapes, all sizes, all colors.
-