0

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

Vinod Yadav
  • 359
  • 1
  • 5
  • 13
  • Noticing /sbin/sh, maybe this is not bash, or a restricted shell. What's the output of $BASH_VERSION? Does the shopt command show some restriction being ON? – rwst Jun 06 '12 at 17:53
  • ThanQ for your comments. Unfortunately both these these are not showing any result. [cifsamidala]#echo $BASH_VERSION sh: BASH_VERSION: Parameter not set. [cifsamidala]#man shopt No manual entry for shopt. [cifsamidala]# [cifsamidala]#shopt sh: shopt: not found. – Vinod Yadav Jun 07 '12 at 05:13

1 Answers1

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.

rwst
  • 2,515
  • 2
  • 30
  • 36
  • Thank you for your suggestion. Could you please tell me how to figure out whether the shell is a restricted ? – Vinod Yadav Jun 07 '12 at 08:57
  • This would depend on which shell this /sbin/sh actually is, which I don't know how to find out, sorry. – rwst Jun 07 '12 at 09:24