Visit Our UNIX and Linux User Community


Reverse Display


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Reverse Display
# 1  
Old 02-11-2002
Reverse Display

I need to display a line in an xterm window but i want to revese the colors so that the background color becomes the foreground color and the foreground color the background color. I want to do this as part of ksh script.

Can somebody tell me how to do this ?

Thanks,
Abu.
# 2  
Old 02-11-2002
Try:
echo $(tput rev) text goes here $(tput rmso)
# 3  
Old 02-12-2002
Is there any difference between "tput rev" and "tput smso"?
# 4  
Old 02-12-2002
Quote:
Originally posted by LivinFree
Is there any difference between "tput rev" and "tput smso"?
That depends on the capabilities of the terminal and the author of the terminal's terminfo entry.

"rev" is clearly reverse video.

As for smso, the terminfo man page states:
Quote:
Choose one display method as standout mode and use it to highlight error messages and other text to which you want to draw attention. Choose a for of display that provides strong contrast but that is easy on the eyes. (We recommend reverse-video plus half-bright or reverse-video alone.
Hmmm...as I look at the man page though, I see that I shouldn't have used "rmso"...
Quote:
sgr0 should be used to turn off all video enhancement capabilities. It should always be specified because it represents the only way to turn off some capabilities, such as dim or blink.
So this is a better answer:

echo $(tput rev) text goes here $(tput sgr0)
# 5  
Old 02-12-2002
Aha... I didn't realize that there was a more correct way that "rmso"... Thank you for clearing that up for me.
# 6  
Old 02-12-2002
Muchos Gracias.. LivinFree and Perdarbo
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #347
Difficulty: Easy
AWK is a language for processing text files.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reverse command

Hi, Apologies in advance - out of my scope here but would love your help. I have the following command on destination system to copy data from one system to another: rcmd "cd data; find . -print|cpio -ocB" | dd ibs=5k obs=5k|cpio -iducmvB I am looking to run a once off command from the... (1 Reply)
Discussion started by: depn
1 Replies

2. UNIX for Dummies Questions & Answers

Reverse complement

I want to reverse some DNA sequences and complement them at the same time. Thus, A changes to T; C to G; T to A and G to C. example: infile >GHL8OVD01CMQVT SHORT1 TTGATGT >GHL8OVD01CMQVT SHORT2 TTGATGT outfile: >GHL8OVD01CMQVT SHORT1 ACATCAA >GHL8OVD01CMQVT SHORT2 ACATCAA The... (4 Replies)
Discussion started by: Xterra
4 Replies

3. Shell Programming and Scripting

Reverse even lines

I'm trying to reverse every even line in my file using the awk command below but it prints only the odd lines but nothing else: $ awk '(NR % 2) {print}; !(NR % 2) {print | "rev";}' myfile Any idea what I might have done wrong? Thank you. (10 Replies)
Discussion started by: ivpz
10 Replies

4. Shell Programming and Scripting

Reverse Display of a file

Hi all, Just saw a "sed" format to reverse display the file contents, but am not geting its logic completely. I would appreciate if somebody can explain sed '1!G;h;$!d' < filename All I know in this is that : G will add a new line after every line except first one... (5 Replies)
Discussion started by: dextergenious
5 Replies

5. Shell Programming and Scripting

Reverse of a string

Hi All, I have a String str="Manish". I would like to reverse it. I know the option to do this in bash is: echo "Manish" | rev but I have seen an alternate solution somewhere, which states that: str="Manish" echo $str | awk '{ for(i=length($0);i>=1;i--) printf("%s",substr($0,i,1));... (7 Replies)
Discussion started by: manishdivs
7 Replies

6. UNIX for Advanced & Expert Users

DISPLAY=local_host:0.0 ; export DISPLAY

Hi, from my Windows Workstation I can connect with PUTTY to an AIX 6.1 unix server. On AIX via PUTTY I run DBCA which has a grphical interface. Then : #DISPLAY=local_host:0.0 ; export DISPLAY $(hostname) $(whoami):/appli/oracle/product/10.2.0/db_1/bin#dbca _X11TransSocketINETConnect()... (12 Replies)
Discussion started by: big123456
12 Replies

7. Shell Programming and Scripting

Reverse multiword

Just check out the script... 1 #!/bin/bash 2 3 echo -n "Enter a string :: " 4 read str 5 echo -n "Reverse is :: " 6 l=`expr length "$str"` 7 while 8 do 9 m=`echo $str | cut -c "$l"` 10 echo -n $m 11 ... (3 Replies)
Discussion started by: lipun4u
3 Replies

8. Shell Programming and Scripting

How to reverse output?

hi, I have to reverse the command output like below: output: online offline disable maintening killed How to reverse this output like: killed maintening disable offline online It should be ksh script. (4 Replies)
Discussion started by: a2156z
4 Replies

9. Shell Programming and Scripting

Reverse *

when I do $ ls z* List of all files begining with 'z'. But what if I want to do a reverse lookup. Just for interest sake ;) $ ls ztr should be same as $ ls ztr* $ ls zt* $ ls z* (2 Replies)
Discussion started by: azmathshaikh
2 Replies

Featured Tech Videos