LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-20-2012, 01:33 PM   #1
cryingthug
Member
 
Registered: Jun 2009
Posts: 131

Rep: Reputation: 18
Rarely used PS1 attributes - not working


Is there a way to get these attributes to work in my PS1 prompt?:

Code:
blink='\[\033[00;05m'
    reverse='\[\033[00;03m'
    italic='\[00;03m'
 
Old 05-20-2012, 01:52 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Actually they are:
Code:
blink='\e[5m'
reverse='\e[7m'
italics='\e[3m'
You can use the octal code 033 in place of e to specify the escape character:
Code:
blink='\033[5m'
reverse='\033[7m'
italics='\033[3m'
They works on my OpenSuSE terminal (konsole) except the italics, which should depend on the font used by the terminal.
 
Old 05-20-2012, 02:14 PM   #3
cryingthug
Member
 
Registered: Jun 2009
Posts: 131

Original Poster
Rep: Reputation: 18
not working

No luck. colucix. It is not working on my system.
I am using Debian 6 and gnome terminal. I'll test this in another distro one of these days.

Quote:
Originally Posted by colucix View Post
Actually they are:
Code:
blink='\e[5m'
reverse='\e[7m'
italics='\e[3m'
You can use the octal code 033 in place of e to specify the escape character:
Code:
blink='\033[5m'
reverse='\033[7m'
italics='\033[3m'
They works on my OpenSuSE terminal (konsole) except the italics, which should depend on the font used by the terminal.
 
Old 05-20-2012, 02:24 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
I've tried in gnome-terminal on a Centos 6.2 box and only the reverse attribute works. I need to deepen more into this before trying to explain.
 
Old 05-20-2012, 03:46 PM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Exactly how are you using them then? Show us the actual prompt code you tried and we may be able to figure out why it's not working for you.
 
Old 05-20-2012, 11:15 PM   #6
cryingthug
Member
 
Registered: Jun 2009
Posts: 131

Original Poster
Rep: Reputation: 18
my code

This is what I have tried:

Code:
$ blink='\033[00;05m'

$ echo -e "${blink}This text is blinking."
Unfortunately it does not blink.
I want to use this to change the output of bash scripts. I do not think I will put it in my prompt.

Last edited by cryingthug; 05-20-2012 at 11:17 PM. Reason: added more info.
 
Old 05-22-2012, 07:52 AM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Well, it's working for me just as you printed it. It could be that your terminal just doesn't support blinking text or something.

BTW, don't forget to set the reset code as well, otherwise all of your console text is going to continue to blink after that (or at least until something you use reconfigures it for you).

Also, if you're trying to set these codes in the shell, then have them available in a script or other sub-process, then you'll have to export them as well.

Code:
$ export blink='\033[00;05m'
$ export reset='\033[0m'

$ echo -e "${blink}This text is blinking.${reset}"
 
Old 06-20-2012, 06:11 AM   #8
cryingthug
Member
 
Registered: Jun 2009
Posts: 131

Original Poster
Rep: Reputation: 18
Thanks

Thanks for your help you guys. I think I will put this on the backburner for now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Five More Engineering Hints You’ll Rarely Hear LXer Syndicated Linux News 3 10-06-2020 04:15 PM
BIND SOA - Refresh Retry Expire Attributes WORKING --- Query harmandeep Linux - Server 0 10-05-2011 06:34 AM
[SOLVED] Ksh93 vs. Pdksh88: Custom PS1 prompt not working kristo5747 Linux - Newbie 1 01-19-2011 11:55 AM
\$ in Bash's PS1 not working for root SlowCoder Linux - General 3 05-28-2008 12:06 PM
ACPI rarely does anything cjames53 Linux - Laptop and Netbook 0 03-05-2005 08:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration