shell历史
bourne shell (sh) 【程序编程相关:shell 十三问】 【推荐阅读:创建屏幕输出-tput基础】c shell (csh) 【扩展信息:老天,I 服了 you】 korn shell (ksh)三种shell 都有它们的优点与缺点
bourne again shell (bash), 正如它的名字所暗示的,是 bourne shell 的扩展.bash 与 bourne shell 完全向后兼容,并且在 bourne shell 的基础上增加与增强了很多特性.bash 也包含了很多 csh 与 korn shell 里的优点,使得 bash 有很灵活与强大的编程接口,同时又有很友好的用户界面.为什么要用 bash 来代替 sh 呢?bourne shell 最大的缺点在于它处理用户的输入方面,在 bourne shell 里键入命令会很麻烦,尤其当你键入很多相似的命令时,而 bash 准备了几种特性使命令的输入变得更容易. bash 的新功能包括 命令补齐.通配符.命令历史记录.别名等.bash 是为互动用户提供的默认shell
一.bash 语法
1 变量
bourne shell有如下四种变量: .用户自定义变量 .位置变量即 shell script之参数 .预定义变量(特殊变量) .环境变量(参考shell定制部分) (1)用户自定义变量 a="hello world" echo $a num=2 echo "this is the $nd" 这将打印: this is the 2nd 使用unset命令删除变量的赋值 $ z=hello $ echo $z hello ... 下一页