Cursor Laction in a shell script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cursor Laction in a shell script
# 1  
Old 10-28-2002
Cursor Laction in a shell script

Hey all;

I'm learning both Shell Scripting and Perl; I want to do the following in both:

I want to know how to move the cursor to a certain location on-screen so that when a user types something - it's on a specific line, about 20 characters in!

I'm using FreeBSD; BASH / pdKSH and Perl 5.6

Many thanks
# 2  
Old 10-28-2002
if you are using vi editor, in esc mode (press ESC)...

if you want to place your cursor on 4 th line, 20 char

typing :1 will place your cursor on the first line, then type 3j to move to 4 th line, then type 20l

won't feel like doing it once you feel at home with vi...

# 3  
Old 10-28-2002
*rofl* I think he wants the script to do this. Something like:
#! /usr/bin/ksh
tput cup 4 20
read data
echo data = $data
exit 0

# 4  
Old 10-28-2002
With bash, it's easy:
echo -e "\\033[${1}G\c"

You can call it like "go_to 13", and it will leave your cursor on the 13th column... I use that function a lot of menuing scripts.
You can also but color tags and whatnot in there...

I've also had luck with that working in ksh93, btw.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with shell script to execute a sql cursor

Hi All, I want some help in writing a shell script which will be in the below form: A logical representation of shell scripts: ->Shell scripts start ->Connect to database ->Execute a sql and store the output in a cursor(need to know is there any concept of cursor in unix) ->Using a loop... (2 Replies)
Discussion started by: Chitragupta
2 Replies

2. Homework & Coursework Questions

When I run the script, the cursor starts on the wrong line?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: It's a shell script using a looping logic, trap, tput, if, while. Most of the scripts in this book aren't written... (2 Replies)
Discussion started by: ckleinholz
2 Replies

3. Programming

shell cursor operations

Hi I need to save the actual cursor position into variable in my script. How can I do it ? thx for help. (1 Reply)
Discussion started by: presul
1 Replies

4. UNIX and Linux Applications

Passing the value of a cursor to another cursor

i have 2 cursors. i want to assign the value of first cursor(employee_id) to the where condition of cursor c2(please refer the bold statement). how do i do if i want to assign the value of c1 to where condition of cursor c2? declare cursor c1 IS select employee_id from employee cursor c2... (1 Reply)
Discussion started by: vkca
1 Replies

5. Shell Programming and Scripting

Getting the cursor position

I need to get the cursor position, and put it inside a variable. Problem is, i don't have the tput command, or ncurses. Apparently I was supposed to try the following: echo -e '\E But I don't get a value or anything. Please help. (3 Replies)
Discussion started by: tinman47
3 Replies

6. Shell Programming and Scripting

Using Cursor in Unix - How to do it (Need Help)

Hi, I have a table in which i have the following data JOB_NO FILE_ID FILE_NAME 1546148 1378788 PDF Sample -1.pdf 1546148 1378789 PDF Sample -2.pdf 1546149 1378790 PDF Sample -3.pdf Now I would like use a cursor like thing in unix to download the files using the file ids and send... (1 Reply)
Discussion started by: uuuunnnn
1 Replies

7. Shell Programming and Scripting

cursor positioning

Hi All, please help me to know how to move the cursor to the desired position? For example, in a shell script, I am displaying echo "\t Enter your Name:" please help me how to move cursor near the first word. for example, if the output is as below ... (3 Replies)
Discussion started by: little_wonder
3 Replies

8. UNIX for Dummies Questions & Answers

Cursor position

Is there a way of finding the current cursor position (line & column) within AIX (4 Replies)
Discussion started by: gefa
4 Replies

9. Shell Programming and Scripting

Changing cursor position using shell script

Hi, Pleae help me on this. Normally, when we say read username, the cursor will come in the first position of next line, but I want the output of the below Normal usage ------------- please enter username: _ I want like the below ---------------------- please enter username: ... (2 Replies)
Discussion started by: balamv
2 Replies

10. Programming

positioning cursor

I am using curses.h and signals.h to control output to screen. My code displays an unchanging prompt that waits for user input. Meanwhile alarm signals are being generated that cause other ancillary messages to appear at other locations on the screen at various times. The problem I have is with... (2 Replies)
Discussion started by: enuenu
2 Replies
Login or Register to Ask a Question