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

刚准备在FreeBSD下学习Shell,结果发现怎么好多命令都没有,比如declare。后来发现连bash都没有,好像bash用的多一些吧,于是就准备将csh换成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):

New packages to be INSTALLED:
    bash: 4.4.12_1

Number of packages to be installed: 1

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

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:
======================================================================

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

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

    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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值