FreeBSD将SHELL从csh换成bash并支持中文显示

刚准备在FreeBSD下学习Shell,结果发现怎么好多命令都没有,好比declare。后来发现连bash都没有,好像bash用的多一些吧,因而就准备将csh换成bash。shell

因为没有bash,因此先得安装一个bash:bash

pkg install bash        -- 下载速度超慢,不过好在bash不大学习

root@www:/usr/ports/ports-mgmt/pkg # pkg install bash
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
ui

New packages to be INSTALLED:
    bash: 4.4.12_1
this

Number of packages to be installed: 1spa

The process will require 8 MiB more space.
1 MiB to be downloaded.
orm

Proceed with this action? [y/N]: y
[1/1] bash-4.4.12_1.txz                        : 100%    1 MiB  36.5kB/s    00:40   
Checking integrity... done (0 conflicting)
[1/1] Installing bash-4.4.12_1...
Extracting bash-4.4.12_1: 100%
Message from bash-4.4.12_1:
======================================================================
it

bash requires fdescfs(5) mounted on /dev/fdio

If you have not done it yet, please do the following:form

    mount -t fdescfs fdescfs /dev/fd

To make it permanent, you need the following lines in /etc/fstab:

    fdescfs    /dev/fd        fdescfs        rw,late    0    0

======================================================================

安装好了bash以后,用以下命令更换shell:

chsh -s /usr/local/bin/bash

 

root@www:/usr/ports/ports-mgmt/pkg # chsh -s /usr/local/bin/bash
chsh: user information updated

而后查看当前SHELL:

[root@www ~]# echo $SHELL
/usr/local/bin/bash

 

更换非root用户默认的shell,#chsh -s /usr/local/bin/bash username  -- 用实际的用户名替换

 

p.s.

        freebsd安装了bash以后并不默认去读取.bashrc文件,若是想作设置相似

        alias ls='ls - G',那么应该直接添加到.profile里面而后:

        source .profile就能够了

 

p.s.

       为了支持中文显示,能够在.profile中添加以下内容:

       export LANG=zh_CN.UTF-8       export LC_CTYPE=zh_CN.UTF-8       export LC_ALL=zh_CN.UTF-8

相关文章
相关标签/搜索