LinuxSir.cn,穿越时空的Linuxsir!

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

怎么恢复bash的设置?

[复制链接]
发表于 2005-2-19 23:00:34 | 显示全部楼层 |阅读模式
不慎把用户目录的文件都删除到回收站了,用root恢复以后一切正常,
只有一个问题:普通用户进入console后提示符变成"bash-2.05b$",并且没有彩色显示文件了
请问怎样才能恢复到以前的样子? :thank

[PHP]echo "thanks";[/PHP]
发表于 2005-2-20 00:52:33 | 显示全部楼层
以前啥样子
回复 支持 反对

使用道具 举报

发表于 2005-2-20 08:32:02 | 显示全部楼层
命令输入:

$alias
alias c='clear'
alias l.='ls -d .[a-zA-Z]* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias m='more'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

alias ls='ls --color=tty' 就是彩色设置参数!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-2-20 12:16:44 | 显示全部楼层
Post by abigant
命令输入:

$alias
alias c='clear'
alias l.='ls -d .[a-zA-Z]* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias m='more'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

alias ls='ls --color=tty' 就是彩色设置参数!


谢谢,原来是这样
查了一下man ls,最后设置为alias ls='ls --color=auto' :thank

还有一个问题,shell的提示符在哪里修改?
回复 支持 反对

使用道具 举报

发表于 2005-2-20 13:24:56 | 显示全部楼层
Post by chrismax2u
谢谢,原来是这样
查了一下man ls,最后设置为alias ls='ls --color=auto' :thank

还有一个问题,shell的提示符在哪里修改?


试一下set -o 里面有一行是shell提示符,修改就可以了。

好象那一行有个 $USER 现在在windows 里面,一会给你查。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-2-20 22:55:01 | 显示全部楼层
谢谢了,我自己查查看
回复 支持 反对

使用道具 举报

发表于 2005-2-20 23:04:36 | 显示全部楼层
这个可能是你需要的



Prompting variables


If you have seen enough experienced UNIX users at work, you may already have realized that the shell's prompt is not engraved in stone. Many of these users have all kinds of things encoded in their prompts. It is possible to put useful information into the prompt, including the date and the current directory. We'll give you some of the information you need to modify your own here; the rest will come in the next chapter.


Actually, bash uses four prompt strings. They are stored in the variables PS1, PS2, PS3, and PS4. [11]The first of these is called the primary prompt string; it is your usual shell prompt, and its default value is "\s-\v\$ ". [12]Many people like to set their primary prompt string to something containing their login name. Here is one way to do this:


[11] PS3 was not defined in bash versions prior to 1.14.


[12] In versions of bash prior to 2.0, the default was "bash\$ ".

PS1="\u—> "

The \u tells bash to insert the name of the current user into the prompt string. If your user name is alice, your prompt string will be "alice-->". If you are a C shell user and, like many such people, are used to having a history number in your prompt string, bash can do this similarly to the C shell: if the sequence \! is used in the prompt string, it will substitute the history number. Thus, if you define your prompt string to be:

PS1="\u \!—> "

then your prompts will be like alice 1-->, alice 2-->, and so on.


But perhaps the most useful way to set up your prompt string is so that it always contains your current directory. This way, you needn't type pwd to remember where you are. Here's how:

PS1="\w—> "

Table 3.6 lists the prompt customizations that are available. [13]


[13] \[ and \] are not available in bash versions prior to 1.14. \a, \e, \H, \T, \@, \v, and \V are not available in versions prior to 2.0.



Table 3.6. Prompt String Customizations




Command


Meaning




\a


The ASCII bell character (007)




\d


The date in "Weekday Month Day" format




\e


The ASCII escape character (033)




\H


The hostname




\h


The hostname up to the first "."




\n


A carriage return and line feed




\s


The name of the shell




\T


The current time in 12-hour HH:MM:SS format




\t


The current time in HH:MM:SS format




\@


The current time in 12-hour am/pm format




\u


The username of the current user




\v


The version of bash (e.g., 2.00)




\V


The release of bash; the version and patchlevel (e.g., 2.00.0)




\w


The current working directory




\W


The basename of the current working directory




\#


The command number of the current command




\!


The history number of the current command




\$


If the effective UID is 0 print a #, otherwise print a $




\nnn


Character code in octal




\\


Print a backslash




\[


Begin a sequence of non-printing characters, such as terminal control sequences




\]


End a sequence of non-printing characters



PS2 is called the secondary prompt string; its default value is >. It is used when you type an incomplete line and hit RETURN, as an indication that you must finish your command. For example, assume that you start a quoted string but don't close the quote. Then if you hit RETURN, the shell will print > and wait for you to finish the string:

$ echo "This is a long line,  # PS1 for the command
> which is terminated down here"     # PS2 for the continuation
$                                   # PS1 for the next command

PS3 and PS4 relate to shell programming and debugging. They will be explained in Chapter 5, and Chapter 9.
回复 支持 反对

使用道具 举报

发表于 2005-2-21 00:52:20 | 显示全部楼层
请善用论坛搜索功能!:thank
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-2-22 11:59:14 | 显示全部楼层
谢谢7楼的朋友

btw:版主,搜过了,没找到
回复 支持 反对

使用道具 举报

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

本版积分规则

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