home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17235 < prev    next >
Encoding:
Internet Message Format  |  1992-12-11  |  2.7 KB

  1. Path: sparky!uunet!cbmvax!andy
  2. From: andy@cbmvax.commodore.com (Andy Finkel)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Help me with Shell scripts (AmigaDos or sksh)
  5. Message-ID: <37763@cbmvax.commodore.com>
  6. Date: 10 Dec 92 05:39:32 GMT
  7. References: <37679@cbmvax.commodore.com> <Bz0FI6.Eut@fc.hp.com>
  8. Reply-To: andy@cbmvax.commodore.com (Andy Finkel)
  9. Organization: Flying Cat, Inc.
  10. Lines: 54
  11.  
  12. In article <Bz0FI6.Eut@fc.hp.com> koren@fc.hp.com (Steve Koren) writes:
  13. >Andy Finkel (andy@cbmvax.commodore.com) wrote:
  14. >
  15. >> >>         cat >pipe:files
  16. >> >>         more <pipe:files
  17. >
  18. >> Actually, the example he gives works exactly as he states.  (this with
  19. >> More 37.4, from the 2.04 Release).  More does some sniffing to figure
  20. >
  21. >I can get this to work _if and only if_ it is not in a script, as the
  22. >original poster mentioned he wanted.  With the AmigaDos CLI under OS
  23.  
  24. Because of the commands (cat) I assumed he was talking about
  25. a script other than an AmigaDOS Execute command script;  Standard
  26. AmigaDOS scripts work by redirecting stdin and hooking it to the
  27. file containing the script.  That's why command line redirection
  28. of a script file doesn't do much good.  There are other ways to implement
  29. scripts without that limitation.
  30.  
  31. >As for the System()/more problem (ie, more doesn't like its stdin
  32. >redirected from a PIPE: file when called from System()), it seems that
  33. >only affects more.  Under OS 3.0, Ray Zarling's "less", and "most" from
  34.  
  35. That's because More is doing sniffing to see what it is connected to.
  36. I'd have to see that section of Sksh code to tell what is going on;
  37. obviously More is making the wrong decision somewhere; whether this
  38. is because of something Sksh isn't setting up, or something More is
  39. doing incorrectly, I can't tell (from here :-) )
  40.  
  41. > but not
  42. >    fgrep mystring myfile | more
  43. >
  44. >What happens in this case is that sksh executes "fgrep" with a
  45. >SYS_Output pointing to something like "PIPE:_temp1" and SYS_Async set.
  46. >Then it runs "less" or "most" or "more" with SYS_Input set to
  47. >"PIPE:_temp1" to read the input from the pipe.  Given that I cannot use
  48.  
  49. I'd have to see your code;  I did something similar in my PIPE
  50. command, which gives command line pipes to the standard shell.
  51. The PIPE command handles all the cases you list properly, and uses 
  52. the System() call, so I assure you, it can be done :-)
  53. (the PIPE command, along with some other hacks for the 2.04 shell,
  54.  is on a Fish disk, and on some of the archives)
  55.  
  56. >  - steve
  57.  
  58.             andy
  59. -- 
  60. andy finkel        andy@cbmvax.commodore.com
  61.  
  62. "Unix is the Operating System of the future, and always will be."
  63.  
  64. Any expressed opinions are mine; but feel free to share.
  65. I disclaim all responsibilities, all shapes, all sizes, all colors.
  66.