Custom PS1 not showing the current working directory

时间秒杀一切 提交于 2019-12-25 05:17:03

问题


I have customized the primary prompt for bash shell but unfortunately it is not showing the current working directory as can be seen below.

[cifsamidala]w# pwd
/home/Vinod/SearchIdIssue
[cifsamidala]w#

Here is what I have customized my PS1:

HOST=`tput bold``hostname``tput sgr0`
PS1="[${HOST}]\w # "

Here is the Shell info for your reference.

[cifsamidala]w# echo $SHELL
/sbin/sh
[cifsamidala]w# echo $0
-sh

I also tried with 'pwd' as below but of no use.

PS1="[${HOST}]`pwd` # "

Kindly let me know if I am missing something here.

Thanks in avance.

Regards,

Vinod Yadav


回答1:


Your shell is not the bash shell and this is probably the reason why it won't work. Ask your sysadmin to give you an unrestricted shell.



来源:https://stackoverflow.com/questions/10911378/custom-ps1-not-showing-the-current-working-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!