![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "find command" to find the files in the current directories but not in the "subdir" | swamymns | Shell Programming and Scripting | 9 | 07-22-2008 12:23 PM |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 03:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| How to get Find command work with a variable passing "*" value? | unxuser | Shell Programming and Scripting | 5 | 08-16-2006 11:47 AM |
| Unix "at" / "Cron" Command New Problem...Need help | Mohanraj | UNIX for Dummies Questions & Answers | 3 | 01-26-2006 08:08 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
"BOLD" printing a variable in PS1 command
I would like to "BOLD" print the hostname in the following statement:
export PS1=$USER"@"$(hostname -s):'$PWD>' Is there a special character I can put before and after the variable to make it bold or blinking? Thanks. |
|
||||
|
That's pretty much the copy+paste answer, but it's in bash syntax, which may or may not work for you. In general, ANSI codes starting with esc [ and ending with m after some numbers work well, but they're not portable to all terminals. A (slightly) more portable solution would be to use tput Code:
PS1=$USER"@"$(tput bold)$(hostname -s)$(tput sgr0):'$PWD>' See the tput manual page for more information. Perhaps you will find that the codes output by tput are exactly equivalent to the hard-coded escape codes given above. In theory, tput should be portable to terminals which do not speak ANSI, but I don't know of a real-world situation where this would make an enormous difference. (The code \033 is octal for the escape character.) Last edited by era; 03-17-2008 at 03:00 PM.. |
|
|||||
|
Hi.
Probably more than you'll ever want to know: HOWTO: Change your Shell Prompt Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|