登录时accurev是否读取任何文件?
在linux中,我需要一旦登录accurev,PS1就会更改为以下内容:
假设我的工作空间放置在路径~/myfiles/accurev/ws/myworkspace
中
<username>@<machineName> : ACCUREV >
,因此,当我例如cd到<代码>~/myfiles/accurev/ws/myworkspace/myproject1/org/daz/ , PS1 是:
<username>@<machineName> : ACCUREV/myproject1/org/daz >
In linux, I need once I login to accurev, the PS1 changes to the following:
suppose my workspace placed in the path ~/myfiles/accurev/ws/myworkspace
<username>@<machineName> : ACCUREV >
so, when I for example cd to ~/myfiles/accurev/ws/myworkspace/myproject1/org/daz/
,
the PS1 be :
<username>@<machineName> : ACCUREV/myproject1/org/daz >
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Accurev info 中的数据来实现此目的。但在每次提示加载时执行此操作可能会很烦人,因为该命令需要几秒钟才能完成。您可以通过检查您的 PWD 是否已更改并仅在更改目录时运行它来调节这一点。
例如,这里有一种方法来获取 PWD 相对于 Accurev Info 的“Top”的路径:
您可以将其放入 PS1,但每个提示都会额外花费 1-2 秒。如果您只想在目录更改时执行此操作,则可以使用 PROMPT_COMMAND 来完成该工作,但前提是
PWD != OLDPWD
。所以。可行吗?是的。值得吗?很难说。
哦,至于你的颜色。查看https://github.com/matschaffer/profile,特别是https://github.com/matschaffer/profile/blob/master/environment.conf 用于 PS1 定义在底部。这应该会给你一些想法。
You can use the data in
accurev info
to pull this off. But doing it on every prompt load might get annoying since the command takes a few seconds to complete. You could maybe temper that by checking if your PWD has changed and only run it when changing directories.For example, here's a way to get the path of your PWD relative to accurev info's 'Top':
You could drop this into PS1, but then every prompt will take 1-2 extra seconds. If you wanted to do it only on directory changes you could probably use PROMPT_COMMAND to do the work but only if
PWD != OLDPWD
.So. Doable? yes. Worth it? hard to say.
Oh, and as for your colors. Check out https://github.com/matschaffer/profile, specifically https://github.com/matschaffer/profile/blob/master/environment.conf for the PS1 definition at the bottom. That should give you some ideas.
您应该使用以下命令输入工作区:
然后在 .bashrc 中添加以下内容:
我个人更喜欢看到工作区,例如:
You should enter your workspaces with the following command:
Then in your .bashrc add the following:
I personally prefer to see the workspace as well like: