[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to make colour prompts for pdksh



2006. July 26. 14:32, James Strandboge:
> On Tue, 2006-07-25 at 22:59 +0200, LeVA wrote:
> > 2006. July 25. 21:20, James Strandboge:
> > > So a no frills color prompt without the title might be:
> > > PS1='^[[0;32m[$USER@${HOST} ${PWD##*/}]$^[[m '
> >
> > Thanks a lot for the reply, I've tried it and it stays the same :\
> > just spits out the characters, and no colours.
>
> $ apt-cache policy pdksh
> pdksh:
>   Installed: 5.2.14-18
>   Candidate: 5.2.14-18
>   Version Table:
>  *** 5.2.14-18 0
>         500 http://http.us.debian.org sarge/main Packages
>         100 /var/lib/dpkg/status
>
> It works fine here.  Two things:
>
> Are you *sure* that the control characters have been entered
> correctly? It is not '^' followed by '['.  It must be the single
> charactor '^['.
>
Now that your pointing this out for me :) indeed I was using a '^' char 
followed by a '['.
But how can I enter that control character? What is the keycombo for it?
> Is your profile being sourced correctly?  I have to do this (and only
> this) in ~/.profile:
> ENV=$HOME/.kshrc; export ENV
I'm putting everything in my .profile. It is always executed so I don't 
see any reason why I should create a .kshrc. BTW, I need you to clarify 
something for me please.
My setup looks like this:

~/.profile:
----------###----------
PS1='whatever...'
export PS1

alias df='df -h'
----------###----------

When I'm using a login shell, everything is working.
But when I'm using a non-login shell (in my case Konsole from KDE), then 
everything gets still sourced from my ~/.profile (so my PS1 
is 'whatever...') *BUT* the aliases are not working.
When I type `alias' to my non-login shell then it just prints out the 
builtin defaults. I think that the feature I need is "alias exporting", 
which could be done with "alias -x df='df -h'", but pdksh doesn't 
support it yet(according to the authors homepage, this is still an 
existing bug).
Quote from http://www.cs.mun.ca/~michael/pdksh/NOTES :
"General features of at&t ksh88 that are not (yet) in pdksh:
    - exported aliases and functions (not in ksh93)."

Can you confirm this or there is a misunderstanding in my head about 
this behaviour, and there is a way to make my aliases work in a 
non-login shell.

NOTE that if I type in the command `alias df='df -h'` in a non-login 
shell then I can use the alias, but I don't want to type in every alias 
everytime :)

>
> and then add whatever to ~/.kshrc.  Try a blank .kshrc except for
> setting PS1 (to make sure there are no syntax errors, etc).  I use
> the same .profile and .kshrc file on Debian Sarge, Ubuntu Dapper,
> OpenBSD and FreeBSD with no problems.
>
> Jamie Strandboge
>
Thanks for the reply

Daniel

-- 
LeVA



Reply to: