Re: ksh, PS1 and PWD

2016-08-04 Thread Paolo Aglialoro
If you like it coloured, and also would appreciate to know which terminal you're in, here's my way: TTY=$(tty) TTY=${TTY##*/} export PS1="\[\e[32;1m\][\[\e[31;1m\]\u\[\e[32;1m\]@\h:\[\e[36;1m\]$TTY\[\e[32;1m\]:\[\e[34;1m\]\w\[\e[32;1m\]] " I usually put this in /etc/profile so that I have it

Re: ksh, PS1 and PWD

2016-08-04 Thread Craig Skinner
Hi Uwe, On 2016-08-04 Thu 00:19 AM |, Uwe Werler wrote: > > PS1='\h:$(_pwd)\\$ ' > You may have already seen this in ksh(1): PS1 ... \W The basename of the current working directory. $HOME is abbreviated as `~'. e.g: PS1="<\u@\h:\W \j> \\$ " $ sleep 5 & [1] 24386

Re: ksh, PS1 and PWD

2016-08-03 Thread lists
Thu, 4 Aug 2016 00:19:44 +0200 Uwe Werler > Hello list, > > maybe this can be done better (~/.kshrc): > [..] > > PS1='\h:$(_pwd)\\$ ' > > Any hints? > > Thanks in advance. Hi Uwe, The best advice as always: simplicity. Check in ksh(1), parameter PS1: man ksh -

Re: ksh, PS1 and PWD

2016-08-03 Thread Fred
On 08/04/16 00:25, Fred wrote: On 08/03/16 23:19, Uwe Werler wrote: Hello list, maybe this can be done better (~/.kshrc): _pwd(){ local _len="25" local _sym="/<.." [[ ${PWD} == ${HOME}* ]] && { PWD="~${PWD#${HOME}}"; _sym="~${_sym#/}"; } [[ ${#PWD} -gt $_len ]] && { typeset

Re: ksh, PS1 and PWD

2016-08-03 Thread Fred
On 08/03/16 23:19, Uwe Werler wrote: Hello list, maybe this can be done better (~/.kshrc): _pwd(){ local _len="25" local _sym="/<.." [[ ${PWD} == ${HOME}* ]] && { PWD="~${PWD#${HOME}}"; _sym="~${_sym#/}"; } [[ ${#PWD} -gt $_len ]] && { typeset -R"$_len" local _pwd=$PWD;

ksh, PS1 and PWD

2016-08-03 Thread Uwe Werler
Hello list, maybe this can be done better (~/.kshrc): _pwd(){ local _len="25" local _sym="/<.." [[ ${PWD} == ${HOME}* ]] && { PWD="~${PWD#${HOME}}"; _sym="~${_sym#/}"; } [[ ${#PWD} -gt $_len ]] && { typeset -R"$_len" local _pwd=$PWD; PWD="${_sym}/${_pwd#*/}"; } print $PWD }