#!/bin/sh与#!/bin/bash的区别
Linux 中的 shell 有很多类型,其中最常用的几种是: Bourne shell (sh)、C shell (csh) 和 Korn shell (ksh), 各有优缺点。Bourne shell 是 UNIX 最初使用的 shell,并且在每种 UNIX 上都可以使用, 在 shell 编程方面相当优秀,但在处理与用户的交互方面做得不如其他几种shell。Linux 操作系统缺省的 shell 是Bourne Again shell,它是 Bourne shell 的扩展,简称 Bash,与 Bourne shell 完全向后兼容,并且在Bourne shell 的基础上增加、增强了很多特性。Bash放在/bin/bash中,它有许多特色,可以提供如命令补全、命令编辑和命令历史表等功能,它还包含了很多 C shell 和 Korn shell 中的优点,有灵活和强大的编程接口,同时又有很友好的用户界面。
- luotaijia@ubuntu:~$ ls -l /bin/sh /bin/bash
- -rwxr-xr-x 1 root root 801808 2010-08-11 03:58 /bin/bash
- lrwxrwxrwx 1 root root 4 2012-11-28 08:06 /bin/sh -> dash
点击(此处)折叠或打开
- 1 a=12345
- 2
- 3 let "a += 1"
- 4 echo "a = $a"
- 5
- 6 b=${a/23/BB}
- 7 echo "b = $b"
点击(此处)折叠或打开
- luotaijia@ubuntu:~/文档/shell学习练习$ /bin/sh 3.2..1.sh
- 3.2..1.sh: 3: let: not found
- a = 12345
- 3.2..1.sh: 6: Bad substitution
- luotaijia@ubuntu:~/文档/shell学习练习$ /bin/bash 3.2..1.sh
- a = 12346
- b = 1BB46
- luotaijia@ubuntu:~/文档/shell学习练习$
#!/bin/sh与#!/bin/bash的区别的更多相关文章
- /bin/sh 与 /bin/bash 的区别
/bin/sh 与 /bin/bash 的区别,用 : 截取字符串不是POSIX 标准的. 区别 sh 一般设成 bash 的软链 (symlink) ls -l /bin/sh lrwxrwxrwx ...
- shell脚本头,#!/bin/sh与#!/bin/bash的区别.
因为今天写了个小脚本,死活不成功,总是报文件或者目录不存在,问了一下我们马同学的正常写法,发现只有脚本头的区别,也就是今天本文要讲的#!/bin/sh与#!/bin/bash. 本文参考:https: ...
- [shell]Linux脚本开头#!/bin/bash和#!/bin/sh是什么意思以及区别
一直以为在shell脚本中#都是代表着注释功能,同样在脚本开始的#!/bin/sh也只是告诉用户这是一个shell脚本,而最近顺手查了下,才发现不是这个意思,分享下面的文章. 转自:http://ww ...
- Linux脚本开头#!/bin/bash和#!/bin/sh是什么意思以及区别
一.意思 #!/bin/sh是指此脚本使用/bin/sh来解释执行,#!是特殊的表示符,其后面根的是此解释此脚本的shell的路径. 其实第一句的#!是对脚本的解释器程序路径,脚本的内容是由解释器解释 ...
- -/bin/sh: /usr/bin/xxx: not found”
运行/usr/bin/helloworld命 令是提示“-/bin/sh: /usr/bin/helloworld: not found”,一开始我以为是helloworld没有运行权限,不过我给了它 ...
- bin/bash 和 /bin/sh 的区别
今天在用ssh Secure shell 连接虚拟机中的Ubuntu编写程序时,想比对一下两个源代码有什么差别,但是在一个ssh 客户端下不断的切换很是费劲.于是想着在主机中再添加一个用户.我原本用s ...
- Linux:/bin/bash和/bin/sh的区别
bash.dash(/bin/bash和/bin/sh) 原文:http://www.cnblogs.com/dkblog/archive/2011/04/02/2003822.html Linux中 ...
- #!/bin/sh & #!/bin/bash区别
在shell脚本的开头往往有一句话来定义使用哪种sh解释器来解释脚本.目前研发送测的shell脚本中主要有以下两种方式:(1) #!/bin/sh(2) #!/bin/bash以上两种方式有什么区别? ...
- [转] #!/bin/sh & #!/bin/bash区别
[From] http://blog.51cto.com/meiling/1826201 在shell脚本的开头往往有一句话来定义使用哪种sh解释器来解释脚本.目前研发送测的shell脚本中主要有以下 ...
随机推荐
- Why does Typescript use the keyword “export” to make classes and interfaces public?
原文: https://stackoverflow.com/questions/15760462/why-does-typescript-use-the-keyword-export-to-make- ...
- 安装 ibm-java-x86_64-sdk-6.0-9.3.x86_64.rpm 的三步骤
yum install libstdc++-devel.x86_64 yum install compat-libstdc++-33.x86_64 rpm -ivh ibm-java-x86_64-s ...
- Unity Game Starter Kit for Windows Store and Windows Phone Store games
原地址:http://digitalerr0r.wordpress.com/2013/09/30/unity-game-starter-kit-for-windows-store-and-window ...
- Vue 源码 基础知识点
1.数据类型判断 const _toString = Object.prototype.toString function toRawType(value) { return _toString.ca ...
- TypeScript 面向对象基础知识
孙广东 2016.4.5 JavaScript如今到处都是.web.server(通过NodeJS).移动应用(通过各种框架).全部这些,TypeScript都能够使用,而且能够为JavaScrip ...
- 【BIRT】修改BIRT的背景颜色
修改BIRT报表的背景颜色都在这里了 在BIRT的webcontent/birt/styles/目录下有如下文件列表: dialogbase.css文件修改 dialogbase_rtl.css文件修 ...
- post请求乱码
jsp页面中 <meta http-equiv="content-type" content="text/html; charset=UTF-8"& ...
- SCF: 简单配置门面
SCF: 简单配置门面 [English] [中文] Simple Configuration Facade, 简写为 SCF.是 代码 和 外部配置 (properties文件, 环境变量,系统/ ...
- 随笔小问题(一)--mac打开class文件
本来不想写这个东西的.但是这个却费了我一番周折. 我要先声明一点的是,我从来不讲iOS当成一个单独的系统,而是将这个操作系统归位unix内核的系统. 简单来说,我把它当成linux在用. 但是,mac ...
- eclipse使用git提交本地项目,提交至远程github上
准备工作: 目的:eclipse使用git提交本地项目,提交至远程github上 eclipse版本:eclipse4.5 64位 jdk版本:jdk-1.7 64位 项目类型:maven web项 ...