📄 00000006.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: <A HREF="mailto:freedom@csie.nctu.edu.tw">freedom@csie.nctu.edu.tw</A> (Tan Koan-Sin), 信区: unix <BR>标 题: UNIX FAQ 中文版 Part 5 <BR>发信站: Computer Sci. & Information Eng., NCTU, (Tue Jul 11 03:11:07 1995) <BR>转信站: phoenix!news.csie.nctu!freedom <BR>Origin: <A HREF="mailto:freedom@dragon.csie.nctu.edu.tw">freedom@dragon.csie.nctu.edu.tw</A> <BR> <BR> <BR>这七篇文章包含一些在 comp.unix.questions 和 comp.unix.shell 常见到的问 <BR>题。请不再问这些问题,因为这些问题已经被回答过太多次了。但也请不要因为 <BR>有人问这些问题而发火,因为他们可能尚未读过这些文章。 <BR> <BR>This collection of documents is Copyright (c) 1994, Ted Timar, except <BR>Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar. <BR> <BR>All rights reserved. Permission to distribute the collection is <BR>hereby granted providing that distribution is electronic, no money is <BR>involved, reasonable attempts are made to use the latest version and <BR>all credits and this copyright notice are maintained. <BR> <BR>Other requests for distribution will be considered. <BR> <BR>All reasonable requests will be granted. <BR> <BR>中文翻译 by {chenjl,freedom,jjyang}<A HREF="mailto:@csie.nctu.edu.tw">@csie.nctu.edu.tw</A> <BR>若您对中文翻译有任何意见请发 e-mail 给 <A HREF="mailto:cfaq@csie.nctu.edu.tw">cfaq@csie.nctu.edu.tw</A> <BR> <BR>我们希望这些文件中的资讯能对你有所帮助,但是并不保证是正确的。若发生损 <BR>害请自行负责。 <BR> <BR>您可以在 rtfm.mit.edu 的 pub/usenet/news.answers 找到包括此文件在内的 <BR>许多 FAQ。 在此目录下的 FAQ 的名字可在文章的顶端的 "Archive-Name:" <BR>那一行找到。 <BR> <BR>[译注: 在台湾请用 NCTUCCA.edu.tw:/USENET/FAQ,在交大的话 <BR> ftp.csie.nctu.edu.tw:/pub/FAQ 是从 CCCA mirror 来的] <BR> <BR> 此一 FAQ 是以"unix-faq/faq/part[1-7]" 为名。 <BR> <BR>这些文章大约分成: <BR> <BR> 1.*)一般性的问题 <BR> 2.*)初学者可能会问的基本问题 <BR> 3.*) 中级的问题 <BR> 4.*) 自以为已经知道所有答案的人可能会问的高级问题 <BR> 5.*) 关於各种 shell 的问题 <BR> 6.*) 各式各样的 Unix <BR> 7.*) An comparison of configuration management systems (RCS, SCCS). <BR> <BR>This article includes answers to: <BR> <BR> 5.1) shell 要如何分类呢? <BR> 5.2) 在一个 shell script 里面要如何 "include" 另一个 shell script 呢? <BR> 5.3) 是不是所有 shell 都有 alias,有没别的替代方案呢? <BR> 5.4) 要如何设定 shell 的变数呢? <BR> 5.5) 要如何得知是否是在一 interactive shell 中? <BR> 5.6) 那些以 "." 开始其档名的档案在各种 shell 中的用途为何? <BR> 5.7) 我想要知道更多各种 shell 的相异之处。请指点明路。 <BR> <BR> <BR>若要找问题 5.5 的答案, 用 regular expression 往前找 "^5.5)" 即可。 <BR> <BR>因为这些都是正当合理的问题, 所以在 comp.unix.questions 或是 <BR>comp.unix.shell 中。每隔一阵子, 就会有这些问题与答案出现, 紧接著就会 <BR>有人对同样问题一再出现发牢骚。关於 UNIX 代表啥呢? 请参考每月 post 在 <BR>news.announce.newusers 中名为 "Answers to Frequently Asked Questions" <BR>的文章。 <BR> <BR>因为 Unix 有太多不同的种类了, 所以很难保证此文件所提供的答案必然会有 <BR>用。在尝试本文件提供的作法前, 请先读读你所使用系统的手册。若你对答案 <BR>有任何建议或更正, 请送 email 给 <A HREF="mailto:tmtaimar@isgtec.com.">tmtaimar@isgtec.com.</A> <BR> <BR>---------------------------------------------------------------------- <BR> <BR>Subject: Can shells be classified into categories? <BR>><I>From: <A HREF="mailto:wicks@dcdmjw.fnal.gov">wicks@dcdmjw.fnal.gov</A> (Matthew Wicks) </I><BR>Date: Wed, 7 Oct 92 14:28:18 -0500 <BR> <BR> <BR>5.1) shell 要如何分类呢? <BR> <BR> 一般来说,shell 可以分成两类。第一类是由 Bourne shell 衍生出来的包括 <BR> sh,ksh,bash,与 zsh。第二类是由 C shell 衍生出来的,包括 csh 与 <BR> tcsh。除此之外还有一个 rc,有人认为该自成一类,有人认为该归类在 <BR> Bourne shell。 <BR> <BR> 把上面的分类法记住,就可以写出所有 Bourne shell类的 shell 或是所有 C <BR> shell 类的 shell 都可用的 script。 <BR> <BR>------------------------------ <BR> <BR>Subject: How do I "include" one shell script from within another shell script? <BR>><I>From: <A HREF="mailto:wicks@dcdmjw.fnal.gov">wicks@dcdmjw.fnal.gov</A> (Matthew Wicks) </I><BR>Date: Wed, 7 Oct 92 14:28:18 -0500 <BR> <BR>5.2) 在一个 shell script 里面要如何 "include" 另一个 shell script 呢? <BR> <BR> 由 Bourne shell 衍生者(包括 rc)用 "." 这个指令。由 C shell 衍生者则使 <BR> 用 "source"。 <BR> <BR>------------------------------ <BR> <BR>Subject: Do all shells have aliases? Is there something else that can be used? <BR>><I>From: <A HREF="mailto:wicks@dcdmjw.fnal.gov">wicks@dcdmjw.fnal.gov</A> (Matthew Wicks) </I><BR>Date: Wed, 7 Oct 92 14:28:18 -0500 <BR> <BR>5.3) 是不是所有 shell 都有 alias,有没别的替代方案呢? <BR> <BR> 除了 sh 外,主要的 shell 都有 alias,不过用法不大一样。例如有些 alias <BR> 不接受参数。 <BR> <BR> Bourne shell 类中 shell function 虽然严格说来不是 alias,不过也差不多 <BR> 了。Shell function 还可以做到一些 alias 所做不到的事情。从 Version <BR> 7 Unix 的衍生出来的系统(包括 System III 与 4.2BSD) 里面的 Bourne shell <BR> 没有 shell function。System V 与 4.3BSD 的 sh 都有 shell function。 <BR> <BR> 用 unalias 来去除 alias, 用 unset 来去除 shell function。 <BR> <BR>------------------------------ <BR> <BR>Subject: How are shell variables assigned? <BR>><I>From: <A HREF="mailto:wicks@dcdmjw.fnal.gov">wicks@dcdmjw.fnal.gov</A> (Matthew Wicks) </I><BR>Date: Wed, 7 Oct 92 14:28:18 -0500 <BR> <BR>5.4) 要如何设定 shell 的变数呢? <BR> <BR> 在 C shell 类的 shell 中用 "set variable=value" 来设定只给这个 shell <BR> 看的变数,用 "setenv variable value" 来设定环境变数。要去除变数则以 <BR> unset 与 unsetenv 为之。在 Bourne shell 类的 shell 中则用 <BR> "variable=value" 来设定变数,若要将一变数并成环境变数则用 "export <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -