At date and time Thu, 6 Nov 2014 17:56:42 +0000 (UTC), Thorsten Glaser wrote:

> Most of this is original ksh, by the way. This should work:
> 
> PS1='$(typeset -R$COLUMNS x="[$USER@$HOSTNAME:$PWD]"; print -nr -- "$x")
> '
> 
> (It also works in pdksh and ksh93 for me.)

OK my last question: I am lost! I am trying the following:

PS1 =
1) line break
2) reverse video, right-aligned $SHELL, $TERM, and $TTY, line break
3) $hostname, line break
4) job number, path (~ if $HOME, ~/org if a subdir of $HOME, full path
otherwise), line break
5) user name, prompt ($ if user, # if root)

This is what I have: a complete mess, but I am learning slowly. I have
grabbed snippets from various places, including some of yours.

PS1=$'\n\e[1;7m${|typeset -R$COLUMNS REPLY="[$TERM]";}\e[0m
[${HOSTNAME:=$(hostname)}]
[\e[1;36m!\e[0m]$(local d=${PWD:-?} p=~ [[ $p = ?(*/) ]] || d=${d/#$p/~} print 
-nr -- "[\e[\
1;35m$d\e[0m]")
$(if [[ $(id -u) -ne 0 ]]; then print "[\e[1;36m$(id -un)\e[0m]$ "; else print 
"[\e[1;35m$(\
id -un)\e[0m]# "; fi)'

Everything is working fine except the path, which is always the full
path (not ~/org, for example), and I am not able to get the SHELL and
TTY variables to print on the first line. I also get the following
error: 

mksh: typeset: [[: is not an identifier

-- 
Gerard Lally

Reply via email to