How to custom display prompt in KornShell to show hostname and current directory?

前端 未结 7 765
一个人的身影
一个人的身影 2021-02-04 09:59

I am using KornShell (ksh) on Solaris and currently my PS1 env var is:

PS1=\"${HOSTNAME}:\\${PWD} \\$ \"

And the prompt displays: hostname:/fu

7条回答
  •  粉色の甜心
    2021-02-04 10:54

    From reading the ksh man page you want

    PS1="${HOSTNAME}:\${PWD##*/} \$ "
    

    Tested on default ksh on SunOS 5.8

提交回复
热议问题