.kshrc 中的自定义 PS1 提示不起作用
我必须在两个主机之间使用 NFS 用户 ID:A 运行 Ksh 93,B 运行 pdksh 88。
我的问题与我在 A 上创建的自定义提示有关:它的工作原理就像一个超级按钮并显示颜色:
PS1="$'\E[46;31m'`logname`@$'\E[1;33m'`hostname -s`:$'\E[0m>"
但我切换了对于B来说,一切都完蛋了(私人信息已被删除)。提示无法像主机A一样显示颜色;相反,颜色代码以“清晰”显示。
$'\E[46;31m'NFS_user_name@$'\E[1;33m'host_name_for_B:$'\E[0m>
主机 B 上的提示不像主机 A 那样显示颜色,因此我希望 B 显示基本提示。为了解决这个问题,我编辑了 .kshrc
文件,在末尾添加了以下代码:
export NODE=`uname -n`
case $NODE in
host_name_for_B)
PS1="[`logname`@`uname -n`]>"
;;
*)
PS1="$'\E[46;31m'`logname`@$'\E[1;33m'`hostname -s`:$'\E[0m>"
;;
esac
The case statements does not work: PS1 does not switch to
PS1="[`logname`@`uname -n`]>"
for host B.
知道可能是什么问题吗?
I have to work with a NFS user id between two hosts: A running Ksh 93 and B running pdksh 88.
My problem has to do with the custom prompt I created on A: it works like a charm and display colors:
PS1="
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
export NODE=`uname -n`
case $NODE in
host_name_for_B)
PS1="[`logname`@`uname -n`]>"
;;
*)
PS1="
The case statement does not work: PS1 does not switch to
PS1="[`logname`@`uname -n`]>"
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'NFS_user_name@
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'host_name_for_B:
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"
But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'NFS_user_name@The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'host_name_for_B:The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'NFS_user_name@The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'host_name_for_B:The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>" ;; esacThe case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'NFS_user_name@The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'host_name_for_B:The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[46;31m'`logname`@But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[1;33m'`hostname -s`:But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
\E[0m>"But I switch over to B, it all goes to hell (private info removed). The prompt fails to display colors like host A ; instead, the color codes are displayed "in clear".
The prompt on host B is not displaying colors like host A so I want B to display a basic prompt instead. To get around the problem, I edited my .kshrc
file to add this code at the end:
The case statement does not work: PS1 does not switch to
for host B.
Any idea what could be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢一位朋友,我的提示代码适用于主机 A 和 B:
感谢大家抽出时间。
Thanks to a friend, this code for my prompt works across both hosts A and B:
Thanks to all for taking the time.
这是另一种适用于 pdksh 和 ksh93 的方法:
Here's another one which works for both pdksh and ksh93: