LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 951|回复: 9

slack 10下的怪问题!

[复制链接]
发表于 2005-10-18 21:44:23 | 显示全部楼层 |阅读模式
我在字符界面下刚开始登陆的时候用ls可以显示不同颜色的文件,我觉得那很好看,而且关键的是他能很好的区别目录和普通文件,使之一目了然!
但当我用su切换为其他用户的时候后,这种效果就没有了,即使是再su回来也没有用,
请问这是怎么回事啊?大家有遇到过这种情况吗?
 楼主| 发表于 2005-10-18 22:22:51 | 显示全部楼层
怎么又没人帮忙啊?
回复 支持 反对

使用道具 举报

发表于 2005-10-18 22:25:18 | 显示全部楼层
use root:

#echo "alias \"ls\"=\"ls --color\"" >> /etc/profile
#soure /etc/profile
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-18 22:41:43 | 显示全部楼层
alias ls="ls --color"
这样可以吗?我好象这样用过,但还是不行的!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-18 22:57:44 | 显示全部楼层
大哥快看看啊!我急用啊!
回复 支持 反对

使用道具 举报

发表于 2005-10-19 10:29:53 | 显示全部楼层
是 alias "ls"="ls --color"

然后将这行放进 /etc/profile 文件里面,下回登陆的时候就可以不用输这个命令了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-19 14:21:52 | 显示全部楼层
这个可以显示颜色,但不能在目录后加个/,刚开机的时候就可以显示这个东东,有什么什么办法把初始化的那个设置复制过来啊!但不知道是那个配置文件!
回复 支持 反对

使用道具 举报

发表于 2005-10-19 15:22:30 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2005-10-19 15:23:46 | 显示全部楼层
How Bash executes startup files.
For Login shells (subject to the -noprofile option):

On logging in:
If `/etc/profile' exists, then source it.

If `~/.bash_profile' exists, then source it,
else if `~/.bash_login' exists, then source it,
else if `~/.profile' exists, then source it.

On logging out:
If `~/.bash_logout' exists, source it.

For non-login interactive shells (subject to the -norc and -rcfile options):
On starting up:
If `~/.bashrc' exists, then source it.

For non-interactive shells:
On starting up:
If the environment variable `ENV' is non-null, expand the variable and source the file named by the value. If Bash is not started in Posix mode, it looks for `BASH_ENV' before `ENV'.

So, typically, your `~/.bash_profile' contains the line
`if [ -f `~/.bashrc' ]; then source `~/.bashrc'; fi' after (or before) any login specific initializations.

If Bash is invoked as `sh', it tries to mimic the behavior of `sh' as closely as possible. For a login shell, it attempts to source only `/etc/profile' and `~/.profile', in that order. The `-noprofile' option may still be used to disable this behavior. A shell invoked as `sh' does not attempt to source any other startup files.

When Bash is started in POSIX mode, as with the `-posix' command line option, it follows the Posix 1003.2 standard for startup files. In this mode, the `ENV' variable is expanded and that file sourced; no other startup files are read.
回复 支持 反对

使用道具 举报

发表于 2005-10-20 19:12:17 | 显示全部楼层
把 alias ls='ls -F --color=auto'
写进 .bash_profile 或 .bashrc

-F 就会在目录名后加 / , 在可执行文件后加 *, ...
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表