[comp.unix.xenix] ksh weird files

csc@chinet.UUCP (Craig Curtin) (05/25/88)

We seem to have some strange behavior when using ksh and running some
shell scripts that exec other shell scripts and then exec back to the
main shell script.  Our application is a test system that may be running
all day in the main menu.  The test person simply selects from a main menu
a sequence of tests to run and they are then execed.  When the tester is
ready to return to the main menu it is exec`ed back to main.  The problem
is that when the sub-shell program is exec'ed the ksh places a copy of the
screen (generated b inline redirection) in a /tmp/pid.sh.level file.  these
files are not that bit its just that when giving the tester a standard shell
/bin/sh these are not there.  When the tester logout all /tmp/pid.sh.level
files are removed but not till then. anyone got any clues??
thanks,
Craig Curtin
ihnp4!chinet!csc

uevans@ecsvax.UUCP (Elizabeth A. Evans) (05/27/88)

In article <5658@chinet.UUCP> csc@chinet.UUCP (Craig Curtin) writes:
>
>We seem to have some strange behavior when using ksh and running some
>shell scripts that exec other shell scripts and then exec back to the
>main shell script.  Our application is a test system that may be running
>all day in the main menu.  The test person simply selects from a main menu
>a sequence of tests to run and they are then execed.  When the tester is
>ready to return to the main menu it is exec`ed back to main.  The problem
>is that when the sub-shell program is exec'ed the ksh places a copy of the
>screen (generated b inline redirection) in a /tmp/pid.sh.level file.  these
>files are not that bit its just that when giving the tester a standard shell
>/bin/sh these are not there.  When the tester logout all /tmp/pid.sh.level
>files are removed but not till then. anyone got any clues??
>thanks,
>Craig Curtin
>ihnp4!chinet!csc

We have a Bourne shell script that provides a menu interface for our
users.  Currently, the users' shell (in passwd) actually *is* the menu
script and it creates /tmp/sh.pid files for each menu screen possibly
generated by the script.  The files are then removed when the user logs
off (which terminates the script).  I've often wondered what was going
on with those files.  The menu screens are all generated with something
like:

echo << END-OF-TEXT

text here

END-OF-TEXT

it appears to be the case that the files are also created tmp when the
menu is executed by someone whose login shell is the C shell.

If anybody knows why these are created, I'd like to hear.  

maart@cs.vu.nl (Maarten Litmaath) (06/10/88)

In article <494@philmds.UUCP> leo@philmds.UUCP (L.J.M. de Wit) writes:
\
\The reason for the late removing of the /tmp files I don't know. But I've some
\other questions. How do you get a sh script running at login (the password
\file entry should be an executable I thought). When login or getty or whoever
\goes to exec the sh script, how does it know which command interpreter to use
\(I don't think it knows of #! lines, in fact it doesn't even know the c.i.
\issue) ?

The magic number #! is well-known to the KERNEL!

\And another question: how do you display text with
\echo << END-OF-TEXT
\
\text here
\
\END-OF-TEXT
\
\? The screens you get are rather small .... 8-).

How about:

	cat << scroll_of_enchant_weapon

	text here

	scroll_of_enchant_weapon
?
(You can also use scroll_of_enchant_armor, whichever you prefer.)
-- 
South-Africa:                         |Maarten Litmaath @ Free U Amsterdam:
           revival of the Third Reich |maart@cs.vu.nl, mcvax!botter!ark!maart

mouse@mcgill-vision.UUCP (der Mouse) (06/23/88)

In article <1289@ark.cs.vu.nl>, maart@cs.vu.nl (Maarten Litmaath) writes:
> In article <494@philmds.UUCP> leo@philmds.UUCP (L.J.M. de Wit) writes:
>> When login or getty or whoever goes to exec the sh script, how does
>> it know which command interpreter to use (I don't think it knows of
>> #! lines, in fact it doesn't even know the c.i. issue) ?
> The magic number #! is well-known to the KERNEL!

This is system-dependent.  BSD kernels (recent ones, at least) do
indeed handle #! on their own; I understand that SV kernels generally
do not.  (I don't know about any others, eg V7/V8/V9, SIII, etc.)

>> And another question: how do you display text with
>> echo << END-OF-TEXT
>> text here
>> END-OF-TEXT

As you probably discovered, you don't: you use cat instead of echo.
Using echo here makes about as much sense as saying

cat textfile | echo

					der Mouse

			uucp: mouse@mcgill-vision.uucp
			arpa: mouse@larry.mcrcim.mcgill.edu