Computing.Net > Forums > Unix > ksh script

ksh script

Reply to Message Icon

Original Message
Name: abby
Date: July 18, 2002 at 11:58:52 Pacific
Subject: ksh script
Comment:

Hi all,
I'm trying to prompt user for input using "read" in ksh script. I want to quit, if the user doen't input any value for say "45" seconds.
Can anyone help me accomplish this task?
Thanks


Report Offensive Message For Removal


Response Number 1
Name: LANkrypt0
Date: July 18, 2002 at 14:37:28 Pacific
Subject: ksh script
Reply: (edit)

Heh, nice little problem, I thought it would be easy, but I am working on it.


Report Offensive Follow Up For Removal

Response Number 2
Name: LANkrypt0
Date: July 18, 2002 at 15:00:24 Pacific
Subject: ksh script
Reply: (edit)

I cant figure this one out. Problem it seems is that when you issue the read command it puts the script on "hold". Ill keep thinking/working on it and post a something tomorrow (explaination as to why not if I cant get it :)


Report Offensive Follow Up For Removal

Response Number 3
Name: Frank
Date: July 19, 2002 at 00:56:11 Pacific
Subject: ksh script
Reply: (edit)

Abby,

On HP-UX use "reply=`line -t 45`

refer to "man line" for detail description.
This is not portable to other Unix.

If you are not using HP-UX please specify which kind of unix you are using.

No RISK no fun
Frank


Report Offensive Follow Up For Removal

Response Number 4
Name: Frank
Date: July 19, 2002 at 01:35:26 Pacific
Subject: ksh script
Reply: (edit)

Abby,

In the menawhile i wrote the following:
It is a litel bit long and uncomfortable but it past the first tests.


DATE_TIMEOUT=45
FILE_PID=/tmp/`basename $0`_$$
echo $$ > $FILE_PID

kill_time ()
{
sleep $DATE_TIMEOUT
if [ -f $FILE_PID ]
then
kill -9 `cat $FILE_PID`
rm $FILE_PID
fi
}

kill_time&

echo "\007kann den echt keiner lesen ? (y or n, default: y) \c"
read testen
rm $FILE_PID

echo $testen


No RSIK no fun

Frank


Report Offensive Follow Up For Removal

Response Number 5
Name: Steve
Date: July 20, 2002 at 17:13:09 Pacific
Subject: ksh script
Reply: (edit)

That looks like a nice solution Frank. Will have to check it out.

So ist das leben(sp).


Report Offensive Follow Up For Removal


Response Number 6
Name: Frank
Date: July 21, 2002 at 01:53:03 Pacific
Subject: ksh script
Reply: (edit)

Steve,

es ist wie es ist, und es wird wie wir es machen. :-)
Kleiner philosophischer anfall.


No RSIK no fun
Frank


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: ksh script

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge