shell script help needed.

Hi,

I have been trying to write a script which allows me to edit the default input value.

Let me explain it here what exactly I am trying to do:

My script execution will be like this...

Enter the location to install :/home/kssm_

here with in my script I want to give the user of the script with a default value /home/kssm which should be editable. The user should be able to edit the default input value.

I am tired experimenting with 'stty icanon'.

I have seen such type of things done in many installation programs.

I would like to know how it could be done.

Thanks,

Mitra.

[666 byte] By [srinivasam_ks] at [2007-11-25 23:34:29]
# 1

If user input is to happen during script execution you could take a look at 'read' in the man page for 'ksh'...if you're using the Solaris default shell.

When input is read into a variable you can manipulate the location name in your script .

Alternatively you can take the input as an argument to the script upon execution - which will be available in the appropriate variable, $1 for first argument.

-R

rlongva at 2007-7-5 18:19:14 > top of Java-index,General,Talk to the Sysop...
# 2
rlongva, that's not quite what the topic starter meant.Unfortunately I'm not aware how one can implement what you're trying to do. I'm actually quite curious!
Cailin_Coilleach at 2007-7-5 18:19:14 > top of Java-index,General,Talk to the Sysop...
# 3

I see that now.

However, using 'read' would be a quick fix - user inputs nothing = keep default, user inputs alternative = new location in script.

However, actually giving the user a line editor through the script is a different thing altogether - and now I'm curious too.

-R

rlongva at 2007-7-5 18:19:14 > top of Java-index,General,Talk to the Sysop...
# 4
Hi Cailin_Coilleach,yes you are right. I am not looking for tlongva's solution. i am searching for some source code of any installation script. if we can get one. we can make out something from that.thanks,MItra.
srinivasam_ks at 2007-7-5 18:19:14 > top of Java-index,General,Talk to the Sysop...
# 5
... I am curious as to why you want to do this.. what would the practical use be...... also, you said that you have seen this in "installation programs"... are those in command line or GUI? I can see how this could be done in Java or XML, but Korn?
Codename47 at 2007-7-5 18:19:14 > top of Java-index,General,Talk to the Sysop...
# 6
Take a look at the GNU readline(3) subroutine. It does what you're looking for. You could probably write a small C-program (statically linked) that could do the job for you. I'm sure there's a Perl version available, if you're into Perl.HTH,Roger S.
Jo_nage at 2007-7-5 18:19:14 > top of Java-index,General,Talk to the Sysop...