home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3917 < prev    next >
Encoding:
Text File  |  1992-09-11  |  1.6 KB  |  46 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: KSH: how to stop $ENV
  5. Message-ID: <mcook.716248461@fendahl.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <1992Sep11.171131.29549@u.washington.edu> <1992Sep11.175318.3198@bnr.ca>
  10. Date: Fri, 11 Sep 1992 21:54:21 GMT
  11. Lines: 33
  12.  
  13. space%bnr.ca (Scott Pace) writes:
  14.  
  15. >Donn Cave (donn@carson.u.washington.edu) wrote:
  16. >: space%bnr.ca (Scott Pace) writes:
  17. >: 
  18. >: | I have a shell script written in ksh (i.e. has #! /bin/ksh at the start).
  19. >: | How do I prevent the ksh from executing $ENV?  This is on HP-UX 7.05.  I
  20. >: | have read the man page, and I don't see any switches that would do this.
  21. >: | What I really want is the equivalent of the -f switch in the csh.
  22. >: 
  23. >: #!/bin/ksh -p
  24. >: 
  25. >: But, don't be surprised if it doesn't work!  It works on some Korn shells,
  26. >: not others.  It's generally not documented, may be obsolete.  I'd like to
  27. >: know - I think it's a valuable feature.  (It's not the same as expecting your
  28. >: users to use the bizarre interactive-only formula for ENV.)
  29. >: 
  30.  
  31. >But I can't use -p since it clobbers the $PATH variable, and I need that to
  32. >be kept intact.
  33.  
  34. If $PATH is being clobbered, it is probably being done in /etc/suid_profile.
  35.  
  36. How about replacing
  37.  
  38.  #! /bin/ksh
  39.  
  40. with
  41.  
  42.  #! /bin/sh
  43.  case "$RANDOM" in '') ENV= ; exec /bin/ksh $0 ${1+"$@"} ;; esac
  44.  
  45. Michael.
  46.