Formatting Read Command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Formatting Read Command
# 1  
Old 08-22-2014
Formatting Read Command

Hi All,

I am using HP Unix and trying to write a script in menu style. At the end of list, I will accept the input from keyboard and take action accordingly. Uptill here it is ok. However, I want to hide the cursor, display it as blinking line after the prompt. How do I achive it. I am using following command:

HTML Code:
   tput cup $x $y
   printf 'Enter Your Choice : '; read -r opt
In HP Unix, read -p is not recognized.

Thanks
Angshuman
# 2  
Old 08-22-2014
Try:
Code:
trap 'stty echo' 0		# This is here in case user breaks out of read with a ctl-C
tput cup $x $y
stty -echo			# Turn echoing off.
printf 'Enter Your Choice : '; read -r opt
stty echo			# Turn echoing on.
echo				# Give feedback that your script read the line typed in.
printf 'Got %s\n' "$opt"	# Do whatever else you want with what your read.

# 3  
Old 08-22-2014
Added to Don's if you have the facility...
Code:
tput civis   # cursor off
tput cnorm   # cursor on
setterm -cursor off
setterm -cursor on

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wall command with nice text formatting

with using wall command, how can i have a carriage return in my broadcast message. i try to broadcast from a file, i were to use "cat myfile | wall" for broadcasting. but when the message broadcast somehow the format run away. this the text in my file: line 1 line 2 line 3 when broadcast ... (3 Replies)
Discussion started by: lsy
3 Replies

2. Shell Programming and Scripting

Formatting for mailx command

Hello all, I am trying to send an email using mailx command. I have a txt file which has formatting like: root@machine# cat /export/home/test/summary.txt T A P O U T - R A T I N G - A U D I T - S U M M A R Y - R E P O... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

3. Shell Programming and Scripting

Read from file and execute the read command

Hi, I am facing issues with the below: I have a lookup file say lookup.lkp.This lookup.lkp file contains strings delimited by comma(,). Now i want to read this command from file and execute it. So my code below is : Contents in the lookup.lkp file is : c_e,m,a,`cd $BOX | ls cef_*|tail... (7 Replies)
Discussion started by: vital_parsley
7 Replies

4. UNIX for Advanced & Expert Users

Paste command formatting

Hi, I was trying to concatenate some files using paste command along with some formatting but getting stuck. The problem is: cat 1.txt A cat 2.txt B C cat3.txt D E cat 4.txt G H (5 Replies)
Discussion started by: abhi1988sri
5 Replies

5. Shell Programming and Scripting

Need help regarding formatting(comm -23 command)

Hello all , I have two files a.txt and b.txt which have same content . They contain data that is fetched from database through a java program. When I delete a line in a.txt and run the below command comm -13 a.txt b.txt I am not getting the expected result i.e. the line i deleted from... (5 Replies)
Discussion started by: RaviTej
5 Replies

6. Shell Programming and Scripting

Formatting the output of ps -eo command

Hi ive been tasked to create a warning email which will be sent when a process exceeds a given percentage of CPU, Ive created the script where it runs: ps -eo pri,pid,user,nice,pcpu,comm | awk '{if($5 >= 2)print $0}' >> /export/home/tjmoore/file2 2>/dev/null I would then run a mail program... (21 Replies)
Discussion started by: 02JayJay02
21 Replies

7. Shell Programming and Scripting

Formatting list of IP addresses into a grep command

Hi I have an input file with a list of random IP addresses, each on a new line. Below is just an example as I omitted the real IP addresses for obvious reasons. Input: random_ip.txt 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1... (7 Replies)
Discussion started by: lewk
7 Replies

8. UNIX for Dummies Questions & Answers

Formatting the o/p of ls command to a file

HI, I require only the file name and the user information from the ls output into a file. The layout of the file is already defined as: User id is in the first 7 bytes FName is in the next 50 bytes Assuming that user id is less than or = 7 bytes and File name is less than or = 50 bytes... (5 Replies)
Discussion started by: Meghna
5 Replies

9. UNIX for Advanced & Expert Users

Formatting Substitution Command Not Working in vi

Unix Gurus, I have a text file I have FTP'd to UNIX so that I can use it to load into our Baan system. When vi the file, I can see that there are formatting characters at the end of each line (^M). To get rid of these, I have read that the following should work: :%s/^M$//g - with the ^M... (11 Replies)
Discussion started by: ERPKEN
11 Replies

10. Shell Programming and Scripting

is running this command via ssh possible? (formatting issues)

Here is the command I want to run: for pkg in `pkginfo | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq It returns the package info in a form such as: 113210-03 VRTSfspro 112392-06 VRTSvmman 113596-03 VRTSvmpro... (1 Reply)
Discussion started by: LordJezo
1 Replies
Login or Register to Ask a Question