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