1834903 Members
3067 Online
110071 Solutions
New Discussion

Re: Scripting help

 
SOLVED
Go to solution
JOHN TURNER_2
Frequent Advisor

Scripting help

ive constructed a shell script that runs commands one after another and outputs them to different files. can i put something in the script so that it runs just one command then requests a key press before going onto the next command.

GUI's are for wimps!
9 REPLIES 9
Rob_132
Regular Advisor

Re: Scripting help

Sure....

read junk

Waits for any (or NO keystroke) followed by return/

Rob
Pete Randall
Outstanding Contributor

Re: Scripting help

John,



read ANSWER
etc.


Pete


Pete
Pete Randall
Outstanding Contributor

Re: Scripting help

John,

This would be better:



echo "press enter"
read ANSWER
etc.


Pete


Pete
James R. Ferguson
Acclaimed Contributor

Re: Scripting help

Hi John:

#!/usr/bin/sh
date >> mylog
read BITBUCKET
echo $(hostname) >> mylog
read BITBUCKET
exit 0

The 'read ' statement serves your need.

Regards!

...JRF...
Steven E. Protter
Exalted Contributor
Solution

Re: Scripting help



The read command will force a enter key to continue

echo "Press enter to continue"
read a


SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rob_132
Regular Advisor

Re: Scripting help

...and the rich get richer....

8-O

Rob
James R. Ferguson
Acclaimed Contributor

Re: Scripting help

Hi (again) John:

HP-UX also provides a nice extension (not necessarily portable) called 'line'. For example:

BITBUCKET=`line -t 10`

...would issue a 'read' into the BITBUCKET variable and timeout after 10-seconds lf nothing is read, allowing the next command to begin execution.

Regards!

...JRF...
Jayan_2
Advisor

Re: Scripting help

dear man

Can u put the sscript here


regards
Jinu
Work whole souled so as to god
Seth Parker
Trusted Contributor

Re: Scripting help

I've just got to add a little here!

How about this:

echo "Press enter \c"
read junk

That way the cursor stays on the same line until you press enter.

Hehe, good luck!
Seth