Computing.Net > Forums > Unix > ksh script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

ksh script

Reply to Message Icon

Name: abby
Date: July 18, 2002 at 11:58:52 Pacific
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

Sponsored Link
Ads by Google

Response Number 1
Name: LANkrypt0
Date: July 18, 2002 at 14:37:28 Pacific
Reply:

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
Reply:

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
Reply:

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
Reply:

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
Reply:

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

So ist das leben(sp).


Report Offensive Follow Up For Removal

Related Posts

See More



Response Number 6
Name: Frank
Date: July 21, 2002 at 01:53:03 Pacific
Reply:

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
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: ksh script

Need Help With KSH Script www.computing.net/answers/unix/need-help-with-ksh-script/6747.html

ksh script www.computing.net/answers/unix/ksh-script/6748.html

Test ssh connection from KSH script www.computing.net/answers/unix/test-ssh-connection-from-ksh-script/6950.html