Operating System - Tru64 Unix
1830228 Members
2481 Online
109999 Solutions
New Discussion

Re: korn shell read statement

 
SOLVED
Go to solution
Tom Wallin_1
Advisor

korn shell read statement

We have recently moved from a 4100 server to an ES40. The 4100 was running Tru64 V4.0F PK7 and the ES40 is running Tru64 V5.1b PK4.
We have a korn shell script that adds users to the system. This script takes a social security number(ssn) and reads a DB and then parses a user name from the obtained info. Next the operator is supposed, and was, prompted for a y/n answer to a question printer by the read statement. i.e. -
read stumenu?"Allow access to stuprod menu option? (y/n) [Y]:"
When this script runs now it bypasses the read statement.
Any ideas?
Tom Wallin
11 REPLIES 11
Hein van den Heuvel
Honored Contributor

Re: korn shell read statement

This is highly unlikely to be introduced by the Tru64 change, and more likely to be caused by an environment change.
I would start by comparing the 'env' output for both environments (if you still have access to the old setup) or just carefully glance over the current one making sure all reference are still valid. Maybe a tool failed to come over execute with -x to see the script flow? Maybe an echo or two to make sure intermediate values are as expected? If need be, consider sharing the script with us (use an attachement?)

good luck,
Hein.
Tom Wallin_1
Advisor

Re: korn shell read statement

It could well be the env. The other system is still available. I will check the environments. I did not mention in the first msg that the script that runs calls a script that does the DB stuff and parsing a user name an a few other things. That script calls a DB compiled script that puts the user id and ssn in a table. Then it returns to the main script that runs the read statements that don't seem to execute.
I will attach the scripts tomorrow morning.

Tom wallin
Michael Schulte zur Sur
Honored Contributor

Re: korn shell read statement

Tom,

use set -x to debug the script and see if it bypasses for some reason your read statement.

greetings,

Michael
ps. please use allways the same login. Otherwise you confuse people. Also you can not assign points if you are not the author of the thread.

thanks.
Tom Wallin_1
Advisor

Re: korn shell read statement

Sorry Michael. I have an account from a long time ago and I can't remember the login/pwd. I will take care of thar though. I have run -x and I can't see the reason for the read statement to not stop. It looks like it is getting EOF. The value of the variable is null. I did see that.

Tom Wallin
Michael Schulte zur Sur
Honored Contributor

Re: korn shell read statement

Tom,

you are not running that script by any chance as crontab job or in the background?
Can you post the lines with the debugging output?

thanks,

Michael
Tom Wallin_1
Advisor

Re: korn shell read statement

No not as a cronjob or in the background.
The script "newuser" does some stuff and then runs script "user_add". User_add does the bulk of the task. At the bottom of user_add, inside an awk cmd a system cmd runs a compiled DB script "ccuid.4ge". I am a little unsure of the environments of such a sequence of calls.
Attached are the scripte, not ccuid.4ge.

I had not kept my runs with the -x. I am going to try calling user_add from newuser without the "." and with -x and see what the difference might be.

Tom Wallin
p.s. it looks like I can only attach one file at a time. I will respond again with the second script.
Tom Wallin_1
Advisor

Re: korn shell read statement

Hers's the second script.

TW
Michael Schulte zur Sur
Honored Contributor
Solution

Re: korn shell read statement

You execute the script with . right?
That overrules the first line with the -x.
Usually on call of a subscript a new shell is started and no values are returned. However when started by . changes on variables in the subscript have an impact on the calling script.

Michael
Tom Wallin_1
Advisor

Re: korn shell read statement

The problem turned out to be the call to the script - "user_add" from the script "newuser". I had put a "." in front of user_add as my first stab at fixing a problem I was having in the user_add script. The call to the compiled program , "ccuid.4ge" embedded in the awk cmd using the system cmd was not getting an environment change is needed to run. I added the commands needed to set the env within the system cmd's parm list.

Thanks to all,
:-)

Tom Wallin
Michael Schulte zur Sur
Honored Contributor

Re: korn shell read statement

Tom,

I am happy to hear of your success. It is a nice policy here to assign points to those who tried to help. Please read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28

thanks,

Michael
Tom Wallin_1
Advisor

Re: korn shell read statement

Read comments in msg above.

Tom Wallin