A entry form

Want to make a entry for using shell script, something like this:

Name:_____________ Age:____________
address:___________

This entry form showed on the screen when the script executed, ask the user enter the field one by one ( user press <Enter>, cursor will be on the next field), anyone got idea about this?
is it possible?

or what command should be used for control the cursor?

Thanks

You can use the echo command with Escape sequences to control the cursor - you would need to insure everyone using the script was using VT100 terminal emulation.

To put in an escape sequence in vi, go to insert mode, use the Control and v keys together, then Control and [ together to create an escape sequence - then [, line number and column.

Example:

^[[19;1H would be setting the cursor on line 19, column 1. You would also need to use the echo -n when requesting feedback (asking a question)

echo -n "^[[19;1H Enter your name: "

You can manage the cursor using the tput command. See the man page for this command.

Thanks Google - never knew that one!

Your Welcome! I recently found this command as well when I had to write a menu interface in shell. I didnt want to keep echo'ing back to the screen and have my menu scroll off the screen. Now, I use tput with sc (to save the cursor position), rc (to restore the cursor position) and ed (to clear the screen below the cursor position). tput won't win any speed races, its slow to initialize but a couple of seconds didnt bother me :wink:

Here is a link I found with examples and a list of options/capabilities. Click Here

Just wanna say :

Thanks