home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7020 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.4 KB

  1. Path: sparky!uunet!eiffel!eiffel.com
  2. From: ram@eiffel.com (Raphael Manfredi)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: checking for interactive shell
  5. Message-ID: <149@eiffel.eiffel.com>
  6. Date: 17 Nov 92 16:39:38 GMT
  7. References: <4254@bcstec.ca.boeing.com>
  8. Sender: ram@eiffel.com
  9. Distribution: usa
  10. Organization: Interactive Software Engineering, Santa Barbara CA
  11. Lines: 33
  12.  
  13. Quoting ced@bcstec.ca.boeing.com (Charles Derykus) from comp.lang.perl:
  14. >How do I perlize the following Bourne shell fragment? (I
  15. >faq'ed fruitlessly)
  16. >
  17. >     case "$-" in                    # interactive ?
  18. >        s) ....
  19. >
  20.  
  21. Hmm... Provided that by "interactive" you mean have the standard
  22. input connected to a tty, then the following should do it:
  23.  
  24.     if (-t) {        # Interactive ?
  25.         ...
  26.     }
  27.  
  28. This is not exactly how I would define "interactive" though. I always
  29. thought it was the -i flag from the shell which dictated whether the
  30. shell was interactive or not. As far as I recall, the -s flag means
  31. that when no more arguments are specified in the command line, then
  32. the shell continues and prompts from stdin.
  33.  
  34. (A typical use is:
  35.  
  36.     remsh host sh -is
  37.  
  38. which gives you a "remote shell" without the burden of rlogin.)
  39.  
  40. This has little or no meaning for perl.
  41. -- 
  42. Raphael Manfredi <ram@eiffel.com>
  43. Interactive Software Engineering Inc.
  44. 270 Storke Road, Suite #7                      / Tel +1 (805) 685-1006 \
  45. Goleta, California 93117, USA                  \ Fax +1 (805) 685-6869 /
  46.