自定义PS1不显示当前工作目录 [英] Custom PS1 not showing the current working directory

查看:169
本文介绍了自定义PS1不显示当前工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为bash shell定制了主提示符,但是不幸的是,它没有显示当前的工作目录,如下所示.

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#

这是我自定义我的PS1的内容:

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

我还尝试了以下"pwd"操作,但没有用.

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

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

请让我知道我是否在这里遗漏了一些东西.

Kindly let me know if I am missing something here.

非常感谢.

此致

Vinod Yadav

Vinod Yadav

推荐答案

您的shell不是bash shell,这可能是它不起作用的原因.请您的系统管理员为您提供不受限制的外壳程序.

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.

这篇关于自定义PS1不显示当前工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆