如何在Centos/RHEL上安装KornShell(KSH)

CentOS admin 9543℃ 0评论

Korn shell 是一个unix上的shell 程序,主要用在各种unix系统上,比如:sun/oracle unix,AIX等。ksh是有贝尔实验室的David korn开发出来的,ksh结合了C shell的交互式特性,并且也融入了bourne shell的语法。

那么如何在linux系统上运行korn shell(ksh)呢?

安装korn shell(ksh)
在linux终端下,通过yum来安装ksh程序
[cc lang=”php”]
$sudo yum install ksh
[/cc]


[cc lang=”php”]
#yum install ksh
[/cc]

命令输出:

[cc lang=”php”]
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: ftp.nsysu.edu.tw
* extras: ftp.cs.pu.edu.tw
* updates: mirrors.stuhome.net
base                                                                 | 3.7 kB     00:00
extras                                                              | 3.4 kB     00:00
updates                                                           | 3.4 kB     00:00
updates/primary_db                                | 3.9 MB     00:05
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package ksh.x86_64 0:20100621-19.el6_4.4 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

============================================================================================
Package        Arch              Version                          Repository

Size
============================================================================================
Installing:
ksh            x86_64            20100621-19.el6_4.4              updates            687 k

Transaction Summary
============================================================================================
Install       1 Package(s)

Total download size: 687 k
Installed size: 1.5 M
Is this ok [y/N]:
Downloading Packages:
ksh-20100621-19.el6_4.4.x86_64.rpm                       | 687 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ksh-20100621-19.el6_4.4.x86_64                     1/1
Verifying  : ksh-20100621-19.el6_4.4.x86_64                    1/1

Installed:
ksh.x86_64 0:20100621-19.el6_4.4

Complete!
[/cc]

查看ksh的安装路径,输入下面的命令:
[cc lang=”php”]
$whereis ksh
[/cc]

或者使用grep命令:
[cc lang=”php”]
$grep –color ksh /etc/shells
[/cc]

命令输出:

ksh install1

将ksh设置为系统默认shell
超级用户(root)可以使用下面的命令为任何用户更改登陆后的shell程序。
命令如下:
[cc lang=”php”]
$sudo chsh -s /bin/ksh 用户名
[/cc]

或者
[cc lang=”php”]
#chsh -s /bin/ksh 用户名
[/cc]

示例:将test用户的默认登陆shell设置为ksh
[cc lang=”php”]
#chsh -s /bin/ksh test
[/cc]

验证当前用户正在使用的shell程序,输入下面的命令:
[cc lang=”php”]
$echo $SHELL
[/cc]
命令输出:
[cc lang=”php”]
/bin/ksh
[/cc]

查看ksh的版本号,输入命令:
[cc lang=”php”]
$ksh –version
[/cc]
命令输出:
[cc lang=”php”]
version         sh (AT&T Research) 93t+ 2010-06-21
[/cc]

转载请注明:OSETC 技术网 » 如何在Centos/RHEL上安装KornShell(KSH)

喜欢 (2)or分享 (0)

您必须 登录 才能发表评论!