LinuxSir.cn,穿越时空的Linuxsir!

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

.login的设置怎么看?

[复制链接]
发表于 2002-8-16 03:18:05 | 显示全部楼层 |阅读模式
我看不懂我的用户目录下的 .login  .bashrc  .cshrc 里的设置,有没有关于这些东西的介绍或是说明文档?
发表于 2002-8-16 12:25:09 | 显示全部楼层
这个问题,请高手弟兄指点一下,也让弟兄们明白明白..
多谢...!
发表于 2002-8-16 15:47:18 | 显示全部楼层
这些是环境的设置文件,Redhat默认的是BASH,它设置文件主要是.bashrc,也就是说我们平常在Linux下使用Shell都是BASH shell,简称B shell。.cshrc和.login是C shell的环境设置文件。B shell和C Shell外表上很容易区别,B Shell的Prompt是$,root Prompt是#,C Shell的Prompt是%。我们可以自由的选用B或C shell,这都是通过这些文件来设置的。其实一般Linux装好为了使用方便我们都要设置环境,平时看到的执行程序前面都要打一个./, 这说明环境没有设置,所以要使用./。具体里面可以设置很多东西,简单的如: 个性化你的Shell的提示符,设置永久的alias等等。
 楼主| 发表于 2002-8-16 21:50:08 | 显示全部楼层
讲得不太清楚,哪里有详细的文档?我想自己设置.....
发表于 2002-8-16 22:44:01 | 显示全部楼层
我只是给你简单的介绍一下,详细情况你自己找找,我先给你提供一些:
由于大家比较熟悉B Shell,所以就给你这些资料,个人认为比较详细了。
http://www.ss64.demon.co.uk/bash/
http://www.ss64.demon.co.uk/bashsyntax/index.html

The Bourne Again Shell (bash)
Environment Variables
A Linux system is a complex beast, and there's a lot to keep track of, a lot of little details that come into play in your normal interactions with various programs (some of which you might not even need to be aware of). Nobody wants to pass a bunch of options to every program that gets run, telling it what kind of terminal is being used, the hostname of the computer, how their prompt should look...

So as a coping mechanism, users have what's called an environment. The environment defines the conditions in which programs run, and some of this definition is variable; the user can alter and play with it, as is only right in a Linux system. Pretty much any shell will have environment variables (if not, it's probably not a very useable shell). Here we will give an overview of the commands bash provides for manipulating its environment variables.

   $ set

set by itself will show you all of the environment variables that are currently defined, as well as their values. Like most bash built-ins, it can also do several other things (with parameters); we'll leave it to the bash(1) man page to cover that, though. An excerpt from a set command on one of my computers looks like this:

   PATH=/usr/local/lib/qt/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
   /usr/openwin/bin:/usr/games:.:/usr/local/ssh2/bin:/usr/local/ssh1/bin:
   /usr/share/texmf/bin:/usr/local/sbin:/usr/sbin:/home/logan/bin
   PIPESTATUS=([0]="0")
   PPID=4978
   PS1='\h:\w\$ '
   PS2='> '
   PS4='+ '
   PWD=/home/logan
   QTDIR=/usr/local/lib/qt
   REMOTEHOST=ninja.tdn
   SHELL=/bin/bash

Notice that PATH variable we discussed earlier; I can run anything in any of those directories simply by typing its base filename.

   $ unset VARIABLE

unset will remove any variables that you give it, wiping out both the variable and its value; bash will forget that variable ever existed. (Don't worry. Unless it's something you explicitly defined in that shell session, it'll probably get redefined in any other session.)

   $ export VARIABLE=some_value

Now, export is truly handy. Using it, you give the environment variable VARIABLE the value “some_value”; if VARIABLE didn't exist, it does now. If VARIABLE already had a value, well, it's gone. That's not so good, if you're just trying to add a directory to your PATH. In that case, you probably want to do something like this:

   $ export PATH=$PATH:/some/new/directory

Note the use of $PATH there: when you want bash to interpret a variable (replace it with its value), tack a $ onto the beginning of the variable's name. For instance, echo $PATH will echo the value of PATH, in my case:

   $ echo $PATH
   /usr/local/lib/qt/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
   /usr/openwin/bin:/usr/games:.:/usr/local/ssh2/bin:/usr/local/ssh1/bin:
   /usr/share/texmf/bin:/usr/local/sbin:/usr/sbin:/home/logan/bin

Tab Completion
(Here comes something cool again.)


A commandline interface means lots of typing.

Typing is work.

Nobody likes work.

From 3 and 2, we can determine that 4) nobody likes typing. Fortunately, bash saves us from 5 (nobody likes a commandline interface).

How does bash accomplish this wonderful feat, you ask? In addition to the wildcard expansion we discussed before, bash features “tab completion”.

Tab completion works something like this: You're typing the name of a file. Maybe it's in your PATH, maybe you're typing it out explicitly. All you have to do is type enough of the filename to uniquely identify it. Then hit the tab key. bash will figure out what you want and finish typing it for you!

Example time. /usr/src contains two subdirectories: /usr/src/linux and /usr/src/sendmail. I want to see what's in /usr/src/linux. So I just type ls /usr/src/l, hit the TAB key, and bash gives me ls /usr/src/linux.

Now, suppose there are two directories /usr/src/linux and /usr/src/linux-old; If I type /usr/src/l and hit TAB, bash will fill in as much as it can, and I'll get /usr/src/linux. I can stop there, or I can hit TAB again, and bash will show a list of directories that match what I've typed so far.

Hence, less typing (and hence, people can like commandline interfaces). I told you it was cool.

发表于 2002-8-16 22:50:21 | 显示全部楼层
其实C Shell相当不错。
发表于 2002-12-20 18:09:43 | 显示全部楼层

sash是不是LINUX的SHELL

我的系统默认启动的是这个SHELL。
我不太想用这个
不知怎么更改系统默认启动的SHELL。
另外我在机子上找不到.bashrc这个文件。
但cshrc却有。现在我想改环境变量PATH
都不知道怎么办了。
我试着更改profile 文件中PATH值的。
但没用。
现在每次运行一些命令要输入路径。
好麻烦。
在启动X时也有问题。(另有主题)
发表于 2002-12-20 18:35:59 | 显示全部楼层
sash 也是shell 就叫sash shell,你用的是什么版本的Linux?你用的这个版本我不熟悉,Redhat的用户管理器可以配置用户使用的shell。
你可以用BASH shell来转到bash shell。退出用ctrl-D或exit命令。
发表于 2002-12-20 22:56:16 | 显示全部楼层

用的是debian/GNU LINUX 2.0.36

谢谢!
怎么回复得这么快啊。
我用的是Debian /GNU linux 2.0.36
版本比较老。可惜没有办法升级。
是不是用bash 和 sash 命令在各个SHELL中切换。
但要每次输入。不太方便。
这个倒不是主要的现在是环境变量怎么改。
有许多命令不能直接用(要加入路径)。
发表于 2002-12-21 11:17:18 | 显示全部楼层
有许多命令不能直接用(要加入路径)。


这个得设置PATH

用这篇也行,设置一下就行了。

http://www.linuxsir.cn/forum.php?mod=viewthread&tid=17720
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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