How the teminal shell HostName can be as “229:~ lancee$” ?

2011-03-01 19:14:39 +08:00
 lancee
登入MB终端的时候本应是:
"Last login: Tue Mar 1 17:19:48 on ttys000
ly-lanceedemacbook:~ lancee$ "

有的时候却是:
"229:~ lancee$"
是什么意思呢?

谢谢解答。

It prints :

"Last login: Tue Mar 1 17:19:48 on ttys000 ly-lanceedemacbook:~ lancee$ "
when I login terminal on my Macbook with networking.

But sometime go like this :

"229:~ lancee$"
random numbers, Is there any hackTools working within the local area network? or means what?

stackoverflow.com/questions/5152882/how-the-teminal-shell-hostname-can-be-as-229-lancee
5486 次点击
所在节点    问与答
6 条回复
TheOnly92
2011-03-01 19:38:27 +08:00
如 stackoverflow 那位仁兄所说的,执行 echo "$PS1" 的结果是什么?这个 grep 'PS1' ~/.profile ~/.bashrc /etc/profile 呢?
lancee
2011-03-01 20:05:53 +08:00
@TheOnly92 谢谢:D

echo "$PS1"
\h:\W \u\$

ly-lanceedemacbook:~ lancee$ grep "\h:\W \u\$" ~/.profile
ly-lanceedemacbook:~ lancee$ grep "\h:\W \u\$" ~/.bashrc
grep: /Users/lancee/.bashrc: No such file or directory
ly-lanceedemacbook:~ lancee$ grep "\h:\W \u\$" /etc/profile

shell只知皮毛,学。:P
roamlog
2011-03-01 20:07:49 +08:00
这个可以修改的, 修改你的 shell 配置文件, 比如我的是这样的 http://readful.com/post/2810013340/oh-my-zsh-zsh-theme
lancee
2011-03-01 20:20:19 +08:00
@roamlog thx, 就是说可以改掉 prefix 了?
————> 简单的:lancee ~/…
TheOnly92
2011-03-01 21:14:45 +08:00
那么你的 PS1 就得修改成 \u \W \$ 或者是你喜欢的类型。你可以在 shell 不断执行 PS1="\u \W \$" 诸如此类,然后感到满意后在 home folder 创建一个叫 .bashrc 的文件,然好将 export PS1="..." 存起来就行了。
lainuo
2011-03-01 21:19:41 +08:00
有可能是网络的DHCP服务器改的HOST

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/9119

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX