# Solved: user input and KSH scripts



## surfnschultz (Nov 17, 2003)

How can I get a user to input information, and have my script use the input data.

trying to atuomate a ksh script and it would be nice if asked for the input.


----------



## Squashman (Apr 4, 2003)

I would assume it is the same in all shells.

read variable_name


----------



## surfnschultz (Nov 17, 2003)

lwdsquashman you were right on, was curious about prompting user so here is the finished script. It works well.

echo $line
echo "A 3 digit port number will kill all flip screens"
echo $line
echo "A 4 digit port number will kill ONLY that flip screen"
echo $line
echo "Please enter the 3 or 4 digit port number you want to clear: \c"

read portnum

for spid in $(ps -ef | grep "facet "$portnum | awk {'print$2'}) 

do

kill -9 $spid 2> /dev/null

done

echo All Processes for port $portnum have been cleared



So again the help here is awesome and very helpful. It is so nice to see this kind of help in this day and age of profit profit profit. I am going to approach my company about giving a good donation for this group.


Life is like a bubble don't let it pop.


----------



## Squashman (Apr 4, 2003)

So how do you like working on AIX. I have never gotten a chance to. We have two AIX boxes where I work but the admin will not let me touch them.


----------



## surfnschultz (Nov 17, 2003)

Did some sysadmin when I worked at NASA on a few rs6000. they have one here they run the POS system on so I doing some automation stuff to eliminate a ton of manual work they do daily. If you get a chance help me out on my latest post. I am trying to read a file and then edit a line with values from the file. Wroking on it not getting any where probably just about to bust out and solved it. Yeah RIGht!

I like UNIX all flavors my personal best SGI IRIX I had many machines run for years without a single reboot needed. Took a while to get them stable but once I got them good they worked perfectly for years with little or no intervention, now if I could only say that about Solaris I struggled for years trying to get a good stabel Sun server, they would go for about 30-60 days and then something would crap out. Longest up tiem I saw for a Solaris server was 6 months.


----------

