免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 6340 | 回复: 14
打印 上一主题 下一主题

kornshell Frequently Asked Questions[1]from: www.kornshell.com  关闭 [复制链接]

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-11-20 18:41 |只看该作者 |正序浏览
I.GENERAL QUESTIONS

Q1.What is KornShell?

A1.KornShell is a command and scripting language
that is a superset of the System V UNIX shell,
aka, BourneShell (or 'sh').

Q2.What is ksh?

A2.ksh is the name of the program that implements the
KornShell language.

Q3.What is the history of ksh?

A3.ksh was written by David Korn at Bell Telephone Laboratories.
David Korn is currently at AT&T Laboratories.
The first version of ksh was in 1983.  It was the first
shell to have command line editing with both emacs
and vi style interaction.  The 1986 version was the first
to offer multibyte support.  The 1988 version of ksh
is the version that was adopted by System V Release 4 UNIX
and was a source document for the IEEE POSIX and ISO
shell standards.  The 1993 version is a major rewrite
of the 1988 version and focuses more on scripting.

Q4.Where is the official description of the KornShell language?
A4.The Bolsky and Korn book, "The KornShell Command and Programming
Language", published by Prentice Hall, defines the 1988
version.  The newer Bolsky and Korn book, "The New KornShell Command
and Programming Language", also published by Prentice Hall,
describes the 1993 version.

Q5.What are the major new features of KornShell 1993?
A5.The only major new interactive feature is key binding.
Major new language features are floating point arithmetic,
associative arrays, complete ANSI-C printf, name reference
variables, new expansion operators, dynamic loading of
built-in commands, active variables, and compound variables.
Active and compound variables allow shell variables to
behave like objects.  In addition, ksh93 has been written to be
extensible with an C language API for programming extensions.

Q6.Are any further releases of ksh planned?
A6.Yes, we are in the process of planning for a newer version,
ksh200X.  We are interested in suggestions for new features.
Again, most of the focus will be on scripting and reusability.

Q7.What new features are planned for ksh200X?
A7.We are in the early stage of planning but the likely additions
are namespaces, an inheritance mechanism for objects,
and support for binary objects.  Support for multi-threading
is also being considered.

Q8.Is KornShell public domain?

A8.Yes, the language description is public domain and
can be reimplemented.  Some of the KornShell language
features have been reimplemented in the GNU shell, bash
and in pdksh, a public domain implementation.

Q9.Is ksh public domain?

A9.No, earlier versions were owned by both AT&T and Novell.
The 1993 version is owned by both Lucent and AT&T.

Q10.Is source code available?
A10.Starting in March 2000, the ksh93 source is available
as part of a larger collection of software called
the ast-open software package which can be downloaded
from the site http://www.research.att.com/sw/download.

Q11.What are the licensing terms?
A11.The exact license terms can be found in
http://www.research.att.com/sw/license/ast-open.html

Q12.Does the license allow binaries to be freely redistributed?
A12.Yes, provided you make the license terms available to
everyone you distribute binaries to.

Q13.If I make changes to the code, do I have to make them public?
A13.No, you do not have to make them public.  However, if you
distribute the changes, you must allow us to be able
to get these changes and distribute them along with the source.

Q14.Why do most vendors ship ksh88, not ksh93?
A14.Since ksh88 was included in System V release 4, most vendors
have just included this version.  A separate license was
required for ksh93 from either Lucent or AT&T.  We hope this
situation changes with the release of ksh93 in open source form.

Q15.Do you provide support for ksh?
A15.No, we will try to fix any bugs we hear about in future
releases, but we do not provide any official support.

Q16.Is ksh supported commercially?
A16.Global Technologies, Ltd, http://www.gtlinc.com, distributes
and supports the "Common Operating Environment" which includes
ksh all of the other ast-open tools.  They support it across
a broad range of systems.  Software vendors that supply ksh with
their systems typically support it for that system.

Q17.What is pdksh and is it related to ksh or KornShell?
A17.pdksh is a public domain version of a UNIX shell that is
unrelated to ksh. It supports most of the 1988
KornShell language features and some of the 1993 features.
Some KornShell scripts will not run with pdksh.

Q18.How is the MKS Toolkit Kornshell related to  KornShell?
A18.MKS Tookit Kornshell is a completely independent implementation
that supports a subset of the 1988 KornShell language.

Q19.What systems does ksh run on?
A19.ksh has been written to be portable.  It has been ported
to virtually every known UNIX system.  In addition it runs
on non-UNIX systems such as IBM's MVS using OpenEdition, and
Microsoft's Windows 9X, Windows NT and Windows 2000.
ksh is part of the UWIN (Unix for Windows) software,
http://www.research.att.com/sw/tools/uwin.

Q20.Does ksh conform to the IEEE POSIX and ISO shell standard?
A20.The 1993 version should conform to the 1992 standard.  At one
point it had passed the test suite created by X/OPEN.

Q21.Will KornShell 88 scripts run with KornShell 93?
A21.In almost all cases, the answer is yes.  However,
the IEEE POSIX and ISO standards required a few
changes that could cause scripts to fail.  There is a
separate document that lists all known incompatibilities.

Q22.Can ksh run as /bin/sh?
A22.We have installed ksh as /bin/sh on several systems without
encountering any problems.  Our Linux systems use this
instead of bash.
=====================================================

[ 本帖最后由 寂寞烈火 于 2005-11-20 23:42 编辑 ]

论坛徽章:
0
15 [报告]
发表于 2005-11-23 13:38 |只看该作者
原帖由 dbcat 于 2005-11-23 13:32 发表

还三角呢 :em12::em12:




文档内容不算难,还可以看懂,都是最基础的东西,不过最好用[code]  [     code]

框起来比较好点:em11: 有些变表情符号了

论坛徽章:
0
14 [报告]
发表于 2005-11-23 13:32 |只看该作者
原帖由 大蚂蚁 于 2005-11-23 13:27 发表
麻烦美女把蝌蚪翻译成方块

还三角呢 :em12::em12:

论坛徽章:
0
13 [报告]
发表于 2005-11-23 13:27 |只看该作者
麻烦美女把蝌蚪翻译成方块

论坛徽章:
0
12 [报告]
发表于 2005-11-23 13:17 |只看该作者

论坛徽章:
0
11 [报告]
发表于 2005-11-23 13:16 |只看该作者
----------
Section A:  The Basics

A1)  What is it?

Bash is a Unix command interpreter (shell).  It is an implementation of
the Posix 1003.2 shell standard, and resembles the Korn and System V
shells.

Bash contains a number of enhancements over those shells, both
for interactive use and shell programming.  Features geared
toward interactive use include command line editing, command
history, job control, aliases, and prompt expansion.  Programming
features include additional variable expansions, shell
arithmetic, and a number of variables and options to control
shell behavior.

Bash was originally written by Brian Fox of the Free Software
Foundation.  The current developer and maintainer is Chet Ramey
of Case Western Reserve University.

A2)  What's the latest version?

The latest version is 3.0, first made available on 27 July, 2004.

A3)  Where can I get it?

Bash is the GNU project's shell, and so is available from the
master GNU archive site, ftp.gnu.org, and its mirrors.  The
latest version is also available for FTP from ftp.cwru.edu.
The following URLs tell how to get version 3.0:

ftp://ftp.gnu.org/pub/gnu/bash/bash-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-3.0.tar.gz

Formatted versions of the documentation are available with the URLs:

ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz

Any patches for the current version are available with the URL:

ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/

A4)  On what machines will bash run?

Bash has been ported to nearly every version of Unix.  All you
should have to do to build it on a machine for which a port
exists is to type `configure' and then `make'.  The build process
will attempt to discover the version of Unix you have and tailor
itself accordingly, using a script created by GNU autoconf.

More information appears in the file `INSTALL' in the distribution.

The Bash web page (http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html)
explains how to obtain binary versions of bash for most of the major
commercial Unix systems.

A5) Will bash run on operating systems other than Unix?

Configuration specifics for Unix-like systems such as QNX and
LynxOS are included in the distribution.  Bash-2.05 and later
versions should compile and run on Minix 2.0 (patches were
contributed), but I don't believe anyone has built bash-2.x on
earlier Minix versions yet.

Bash has been ported to versions of Windows implementing the Win32
programming interface.  This includes Windows 95 and Windows NT.
The port was done by Cygnus Solutions (now part of Red Hat) as part
of their CYGWIN project.  For more information about the project, see
http://www.cygwin.com/.

Cygnus originally ported bash-1.14.7, and that port was part of their
early GNU-Win32 (the original name) releases.  Cygnus has also done a
port of bash-2.05b to the CYGWIN environment, and it is available as
part of their current release.  Bash-3.0 is currently being tested and
should be available soon.

Bash-2.05b and later versions should require no local Cygnus changes to
build and run under CYGWIN.

DJ Delorie has a port of bash-2.x which runs under MS-DOS, as part
of the DJGPP project.  For more information on the project, see

http://www.delorie.com/djgpp/

I have been told that the original DJGPP port was done by Daisuke Aoyama.

Mark Elbrecht <snowball3@bigfoot.com> has sent me notice that bash-2.04
is available for DJGPP V2.  The files are available as:

ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204b.zip        binary
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204d.zip        documentation
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204s.zip        source

Mark began to work with bash-2.05, but I don't know the current status.

Bash-3.0 compiles and runs with no modifications under Microsoft's Services
for Unix (SFU), once known as Interix.

A6) How can I build bash with gcc?

Bash configures to use gcc by default if it is available.  Read the
file INSTALL in the distribution for more information.

A7)  How can I make bash my login shell?

Some machines let you use `chsh' to change your login shell.  Other
systems use `passwd -s' or `passwd -e'.  If one of these works for
you, that's all you need.  Note that many systems require the full
pathname to a shell to appear in /etc/shells before you can make it
your login shell.  For this, you may need the assistance of your
friendly local system administrator.

If you cannot do this, you can still use bash as your login shell, but
you need to perform some tricks.  The basic idea is to add a command
to your login shell's startup file to replace your login shell with
bash.

For example, if your login shell is csh or tcsh, and you have installed
bash in /usr/gnu/bin/bash, add the following line to ~/.login:

        if ( -f /usr/gnu/bin/bash ) exec /usr/gnu/bin/bash --login

(the `--login' tells bash that it is a login shell).

It's not a good idea to put this command into ~/.cshrc, because every
csh you run without the `-f' option, even ones started to run csh scripts,
reads that file.  If you must put the command in ~/.cshrc, use something
like

        if ( $?prompt ) exec /usr/gnu/bin/bash --login

to ensure that bash is exec'd only when the csh is interactive.

If your login shell is sh or ksh, you have to do two things.

First, create an empty file in your home directory named `.bash_profile'.
The existence of this file will prevent the exec'd bash from trying to
read ~/.profile, and re-execing itself over and over again.  ~/.bash_profile
is the first file bash tries to read initialization commands from when
it is invoked as a login shell.

Next, add a line similar to the above to ~/.profile:

        [ -f /usr/gnu/bin/bash ] && [ -x /usr/gnu/bin/bash ] &&
                exec /usr/gnu/bin/bash --login

This will cause login shells to replace themselves with bash running as
a login shell.  Once you have this working, you can copy your initialization
code from ~/.profile to ~/.bash_profile.

I have received word that the recipe supplied above is insufficient for
machines running CDE.  CDE has a maze of twisty little startup files, all
slightly different.

If you cannot change your login shell in the password file to bash, you
will have to (apparently) live with CDE using the shell in the password
file to run its startup scripts.  If you have changed your shell to bash,
there is code in the CDE startup files (on Solaris, at least) that attempts
to do the right thing.  It is, however, often broken, and may require that
you use the $BASH_ENV trick described below.

`dtterm' claims to use $SHELL as the default program to start, so if you
can change $SHELL in the CDE startup files, you should be able to use bash
in your terminal windows.

Setting DTSOURCEPROFILE in ~/.dtprofile will cause the `Xsession' program
to read your login shell's startup files.  You may be able to use bash for
the rest of the CDE programs by setting SHELL to bash in ~/.dtprofile as
well, but I have not tried this.

You can use the above `exec' recipe to start bash when not logging in with
CDE by testing the value of the DT variable:

        if [ -n "$DT" ]; then
                [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login
        fi

If CDE starts its shells non-interactively during login, the login shell
startup files (~/.profile, ~/.bash_profile) will not be sourced at login.
To get around this problem, append a line similar to the following to your
~/.dtprofile:

        BASH_ENV=${HOME}/.bash_profile ; export BASH_ENV

and add the following line to the beginning of ~/.bash_profile:

        unset BASH_ENV

A I just changed my login shell to bash, and now I can't FTP into my
   machine.  Why not?

You must add the full pathname to bash to the file /etc/shells.  As
noted in the answer to the previous question, many systems require
this before you can make bash your login shell.

Most versions of ftpd use this file to prohibit `special' users
such as `uucp' and `news' from using FTP.

论坛徽章:
0
10 [报告]
发表于 2005-11-23 13:14 |只看该作者
原帖由 yuyuyou 于 2005-11-20 23:54 发表
烈火兄辛苦了!

要是有中文的就好了。

唉,先收下,还bash呢,ksh。。。。。。。。。。。。。。。。。。。。。



                               BASH FAQ
This is the Bash FAQ, version 3.30, for Bash version 3.0.

This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell.  Bash is a freely-available command
interpreter with advanced features for both interactive use and shell
programming.

Another good source of basic information about shells is the collection
of FAQ articles periodically posted to comp.unix.shell.

Questions and comments concerning this document should be sent to
chet@po.cwru.edu.

This document is available for anonymous FTP with the URL

ftp://ftp.cwru.edu/pub/bash/FAQ

The Bash home page is http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html

----------
Contents:

Section A:  The Basics

A1) What is it?
A2) What's the latest version?
A3) Where can I get it?
A4) On what machines will bash run?
A5) Will bash run on operating systems other than Unix?
A6) How can I build bash with gcc?
A7) How can I make bash my login shell?
A I just changed my login shell to bash, and now I can't FTP into my
    machine.  Why not?
A9) What's the `POSIX Shell and Utilities standard'?
A10) What is the bash `posix mode'?

Section B:  The latest version

B1) What's new in version 3.0?
B2) Are there any user-visible incompatibilities between bash-3.0 and
    bash-1.14.7?

Section C:  Differences from other Unix shells

C1) How does bash differ from sh, the Bourne shell?
C2) How does bash differ from the Korn shell, version ksh88?
C3) Which new features in ksh-93 are not in bash, and which are?

Section D:  Why does bash do some things differently than other Unix shells?

D1) Why does bash run a different version of `command' than
    `which command' says it will?
D2) Why doesn't bash treat brace expansions exactly like csh?
D3) Why doesn't bash have csh variable modifiers?
D4) How can I make my csh aliases work when I convert to bash?
D5) How can I pipe standard output and standard error from one command to
    another, like csh does with `|&'?
D6) Now that I've converted from ksh to bash, are there equivalents to
    ksh features like autoloaded functions and the `whence' command?

Section E:  Why does bash do certain things the way it does?

E1) Why is the bash builtin `test' slightly different from /bin/test?
E2) Why does bash sometimes say `Broken pipe'?
E3) When I have terminal escape sequences in my prompt, why does bash
    wrap lines at the wrong column?
E4) If I pipe the output of a command into `read variable', why doesn't
    the output show up in $variable when the read command finishes?
E5) I have a bunch of shell scripts that use backslash-escaped characters
    in arguments to `echo'.  Bash doesn't interpret these characters.  Why
    not, and how can I make it understand them?
E6) Why doesn't a while or for loop get suspended when I type ^Z?
E7) What about empty for loops in Makefiles?
E Why does the arithmetic evaluation code complain about `08'?
E9) Why does the pattern matching expression [A-Z]* match files beginning
    with every letter except `z'?
E10) Why does `cd //' leave $PWD as `//'?
E11) If I resize my xterm while another program is running, why doesn't bash
     notice the change?
E12) Why don't negative offsets in substring expansion work like I expect?

Section F:  Things to watch out for on certain Unix versions

F1) Why can't I use command line editing in my `cmdtool'?
F2) I built bash on Solaris 2.  Why do globbing expansions and filename
    completion chop off the first few characters of each filename?
F3) Why does bash dump core after I interrupt username completion or
    `~user' tilde expansion on a machine running NIS?
F4) I'm running SVR4.2.  Why is the line erased every time I type `@'?
F5) Why does bash report syntax errors when my C News scripts use a
    redirection before a subshell command?
F6) Why can't I use vi-mode editing on Red Hat Linux 6.1?
F7) Why do bash-2.05a and  bash-2.05b fail to compile `printf.def' on
    HP/UX 11.x?

Section G:  How can I get bash to do certain common things?

G1) How can I get bash to read and display eight-bit characters?
G2) How do I write a function `x' to replace builtin command `x', but
    still invoke the command from within the function?
G3) How can I find the value of a shell variable whose name is the value
    of another shell variable?
G4) How can I make the bash `time' reserved word print timing output that
    looks like the output from my system's /usr/bin/time?
G5) How do I get the current directory into my prompt?
G6) How can I rename "*.foo" to "*.bar"?
G7) How can I translate a filename from uppercase to lowercase?
G How can I write a filename expansion (globbing) pattern that will match
    all files in the current directory except "." and ".."?

Section H:  Where do I go from here?

H1) How do I report bugs in bash, and where should I look for fixes and
    advice?
H2) What kind of bash documentation is there?
H3) What's coming in future versions?
H4) What's on the bash `wish list'?
H5) When will the next release appear?

论坛徽章:
0
9 [报告]
发表于 2005-11-21 00:02 |只看该作者
每个字母我好像都认识、
:P
委实是看不懂、

论坛徽章:
0
8 [报告]
发表于 2005-11-20 23:54 |只看该作者
烈火兄辛苦了!

要是有中文的就好了。

唉,先收下,还bash呢,ksh。。。。。。。。。。。。。。。。。。。。。

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
7 [报告]
发表于 2005-11-20 23:38 |只看该作者
原帖由 大蚂蚁 于 2005-11-20 19:18 发表
为啥我看的时候好像有很多蝌蚪再动

这个文档很经典的,时常看看,应该有所帮助的
BTW: :em11::em11:
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP