LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-19-2011, 11:38 AM   #1
kristo5747
Member
 
Registered: Jul 2010
Location: Earth
Distribution: Ubuntu 11.04 (Natty Narwhal)
Posts: 31

Rep: Reputation: 0
Ksh93 vs. Pdksh88: Custom PS1 prompt not working


Greetings!

I have to work with a NFS user id between two hosts: A running Ksh 93 and B running pdksh 88. Both host run RedHat.

My problem has to do with the custom prompt I created on A: it works like a charm and display colors:

Code:
   PS1="$'\E[46;31m'`logname`@$'\E[1;33m'`hostname -s`:$'\E[0m>"
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".

Code:
   $'\E[46;31m'NFS_user_name@$'\E[1;33m'host_name_for_B:$'\E[0m>
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc file to add this code at the end

Code:
    export NODE=`uname -n`
    
    case $NODE in
        host_name_for_B)
            PS1="[`logname`@`uname -n`]>"
            ;;
        *)
            PS1="$'\E[46;31m'`logname`@$'\E[1;33m'`hostname -s`:$'\E[0m>"
            ;;
    esac
The case statement does not work: PS1 does not switch to `PS1="[`logname`@`uname -n`]>"`.

Any idea what could be the problem? Thanks!
 
Old 01-19-2011, 12:55 PM   #2
kristo5747
Member
 
Registered: Jul 2010
Location: Earth
Distribution: Ubuntu 11.04 (Natty Narwhal)
Posts: 31

Original Poster
Rep: Reputation: 0
A very clever friend of mine figured out my problem:

Code:
PS1="$(printf "\033[46;31m%s@\033[1;33m%s\033[0m>" $(logname) $(hostname -s))"
PS1 works across both hosts, A and B. Thanks for taking the time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Setting a Custom PS1 For Users? carlosinfl Red Hat 4 09-11-2010 11:11 AM
Custom PS1 For New Users? carlosinfl Debian 6 07-30-2010 03:37 PM
Prompt not hard returning after PS1 variable change? SlowCoder Linux - Newbie 5 05-01-2007 10:16 PM
Post your BASH prompt [PS1]? introuble General 11 12-27-2006 04:47 PM
$PS1 different in X and prompt codec Slackware 7 06-27-2004 05:42 PM


All times are GMT -5. The time now is 12:49 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration