Ubuntu切换默认sh为bash或者dash

来源:互联网 发布:视频编辑软件下载 编辑:程序博客网 时间:2024/05/20 17:42
1、bash与dash
从Ubuntu 6.10开始,默认使用dash(theDebian Almquist Shell)而不是bash(the GNUBourne-Again Shell).
但Login Shell还是bash. 原因是dash更快、更高效,而且它符合POSIX规范。Ubuntu在启动的时候会运行很多shell脚本,使用dash可以加快启动速度。
 
1.1、什么是bash?
Bash(GNU Bourne-Again Shell)是许多Linux平台的内定Shell,事实上,还有许多传统UNIX上用的Shell,像tcsh、csh、ash、bsh、ksh等等,Shell Script大致都类同,当您学会一种Shell以后,其它的Shell会很快就上手,大多数的时候,一个Shell Script通常可以在很多种Shell上使用
 
1.2、什么是dash?
dash is the standard command interpreter for the system. The current version of dash is in the process of being changed to conform with the POSIX 1003.2 and 1003.2a specifications for the shell.
 
2、切换bash和dash
2.1、查看与使用
先用命令ls -l /bin/sh看看
/bin/sh -> dash
默认sh为dash
我们会发现Ubuntu默认采用的是 dash
 
2.2、切换sh为bash
如果要修改默认的sh,可以采用命令
sudo dpkg-reconfigure dash
然后选择否
成功后再执行
ll /bin/sh
结果是:/bin/sh -> bash
修改成功!
 
2.3、切换sh为dash
当然我们也可以使用
sudo dpkg-reconfigure dash
把sh修改回去。
0 0
原创粉丝点击