问题
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