免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1566 | 回复: 6
打印 上一主题 下一主题

如何定制提示符 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-03-11 16:34 |只看该作者 |倒序浏览
请问在SunOS下如何定制提示符?

比如我在#提示符下进入到ASE这个目录,则系统提示符为#ASE>;

我在.profile 文件中export PS1,PS1为$PWD,好像不能用,大家知道的能告诉我吗,先谢了。

论坛徽章:
0
2 [报告]
发表于 2004-03-11 16:48 |只看该作者

如何定制提示符

问题太简单没人理吗?:em12:

论坛徽章:
0
3 [报告]
发表于 2004-03-11 16:52 |只看该作者

如何定制提示符

在SCO UNIX下export PS1='$PWD>;'可以用,SunOS下环境变量不是这个$PWD吗?:em12: :em12:

论坛徽章:
0
4 [报告]
发表于 2004-03-11 17:15 |只看该作者

如何定制提示符

不知道的也进来讲一声,还没等到答案连贴子都快掉底看不见了。

论坛徽章:
0
5 [报告]
发表于 2004-03-11 18:21 |只看该作者

如何定制提示符

Changing Your Command Prompt
The syntax you use to change your command prompt depends on what shell you are
using.
Bourne, Bourne Again, Korn, and Z Shells
In the Bourne, Bourne Again, Korn, and Z shells, use the PS1 command to redefine
your command prompt. The following are three examples:
 To set the prompt to a colon (:), followed by a space, type the following command.
PS1=": "
 To create a prompt that consists of your machine name, followed by a colon and a
space, type the following command.
PS1="‘hostname‘: "
 To set the prompt to your machine name, followed by your login name in braces
{}, a colon, and a space, type the following command
PS1="‘hostname‘{‘logname‘}: "
Type any of the previous examples to change your current command prompt. This
change applies until you change your command prompt again or log out.
If you want to make your changes more permanent, add one of the previous examples
(or a prompt of your own creation) to your user profile file. If you follow this
guideline, the prompt you specify appears each time you log in in or start a new shell.
C and TC Shells
For the C and TC shells, you personalize your command prompt with the set
prompt command. The following are three examples:
 To set the prompt to a percent sign followed by a space, type the following
command.
example% set prompt="% "
 To create a prompt that consists of your machine name, followed by the history
number of the command (hostname1, hostname2, hostname3, and so on), followed by
a colon, type the following command.
example% set prompt="‘hostname‘\!: "
 To set the prompt to your machine name, followed by your login name in braces, a
colon, and a space, type the following command.
example% set prompt="‘hostname‘{‘logname‘}: "
Type any of the previous examples to change your current command prompt. This
change applies until you change your command prompt again or log out.
If you want to make your changes more permanent, add one of the previous examples
(or a prompt of your own creation) to your user profile file. If you follow this
procedure, the prompt you specify appears each time you log in or start a new shell.

论坛徽章:
0
6 [报告]
发表于 2004-03-12 11:07 |只看该作者

如何定制提示符

简单的说,Bourne Shell不支持$PWD,换成KSH就可以了。在Bourne Shell和KSH下,都可以用`pwd`,但Bourne Shell不能实现动态的目录显示。

论坛徽章:
0
7 [报告]
发表于 2004-03-12 15:51 |只看该作者

如何定制提示符

懂了,在本站论坛上的贴子都讲的不够清楚,我的SHELL环境只有SH,KSH是不支持PS1的,楼上的KSH我试过了,不错,是个静态的,可惜了。
非常感谢MELONM和xingshb的帮助。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP