Operating System - HP-UX
1838703 Members
2947 Online
110128 Solutions
New Discussion

Writing a small script that will prompt me for a value?

 
SOLVED
Go to solution
MAD_2
Super Advisor

Writing a small script that will prompt me for a value?

I am writing a small script that will transfer directoreis/files to valid host names.

However, I am not sure how to prompt for the valid value so that the user may choose a string to validate the transfer.

Please provide me with a small clue, that's the only section I am not done with yet.

I am using ksh!
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
4 REPLIES 4
John Carr_2
Honored Contributor
Solution

Re: Writing a small script that will prompt me for a value?

Hi

read myinput

this will assign the entered string to the variable which can then be processed accordingly.

John.
MAD_2
Super Advisor

Re: Writing a small script that will prompt me for a value?

Thanks John, that's what I was looking for...
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Robert R. Colp
Advisor

Re: Writing a small script that will prompt me for a value?

I know that is the answer for most shells, however if you are using csh you need to use the "$<" to direct the input to your script file. (I only post this if someone else is trying to make the "read" command work with csh).
Niraj Kumar Verma
Trusted Contributor

Re: Writing a small script that will prompt me for a value?

Hi,

you can also use

line myinput

read more about line
# man line

This has a advantage of specifying the timeout period also.

-Niraj
Niraj.Verma@philips.com