home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / shell / 3519 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  1.9 KB

  1. Xref: sparky comp.unix.shell:3519 comp.sys.hp:9422
  2. Newsgroups: comp.unix.shell,comp.sys.hp
  3. Path: sparky!uunet!utcsri!helios.physics.utoronto.ca!alchemy.chem.utoronto.ca!system
  4. From: system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson))
  5. Subject: Re: ksh bk-gnd behaviour
  6. Message-ID: <1992Aug19.001130.29153@alchemy.chem.utoronto.ca>
  7. Organization: University of Toronto Chemistry Department
  8. References: <891@marvin.jpl.oz>
  9. Date: Wed, 19 Aug 1992 00:11:30 GMT
  10. Lines: 42
  11.  
  12. In article <891@marvin.jpl.oz> tony@marvin.jpl.oz (Tony Sanderson) writes:
  13. >
  14. > With ksh (HP-UX on a new '720), I find that scripts which successfully
  15. >used either the "[ -t 0 ]" or "tty" commands on our old system to detect
  16. >that the script has been backgrounded no longer work.  I'm told (by HP)
  17. >that this is a result of the job control feature (which is absent in the
  18. >ksh on our older machines),  causing stdin to remain attached to the user
  19. >terminal when a script is backgrounded.
  20.  
  21. I just posted our solution to this last week; the real solution is
  22. for HP to fix 'stty' and friends so they don't hang your script when
  23. they are in the background (BSD fixed this years ago). Anyways, here it is
  24. again (.kshrc is read for each ksh via the ENV variable):
  25.  
  26. #
  27. # Prompt generator - keep track whether prompt was already set,
  28. # since that is used to determine whether the shell is "interactive"
  29. # or not.
  30. #
  31. if [ "$LEVEL" = "" ]; then
  32.    let "LEVEL = 0"
  33. fi
  34. if [ "$PS1" != "" -a "$LEVEL" = "0" ]; then
  35.    interactive=yes
  36. else
  37.    interactive=no
  38. fi
  39. host=`hostname`
  40. PS1=${host}:'${PWD}# '
  41. export PS1
  42. let "LEVEL = $LEVEL + 1"
  43. export LEVEL
  44. ...
  45. #
  46. # Do some terminal dependent stuff.
  47. #
  48. if [ "$interactive" = "yes" ]; then
  49.    stty -tabs erase ^H kill ^U intr ^C susp ^Z dsusp ^Y tostop ixon ixoff
  50. fi
  51. -- 
  52. What are the chances that any computer system will ever "work" properly?
  53. ... and Slim just left town. -*- Mike Peterson, SysAdmin, U/Toronto Chemistry
  54.