shell脚本在Linux中的重要用途 Makefile对工程完成自动化编译
什么是shell呢?shell是用户和内核交互的接口
一个简单的shell程序:
chmod u+x ./shelldemo 添加可执行权限
如果执行shelldemo 无法正常运行该shell脚本、而执行./shelldemo 却可以 why?因为执行shelldemo会去找环境变量 而 在环境变量下、无法找到shelldemo 故无法执行 解决办法 将当前shelldemo的路径添加到环境变量PATH中!
vim /etc/profile 将当前变量添加到PATH中 source /etc/profile 直接执行shelldemo也可以运行结果!
各种操作系统的shell
UNIX下有Bourne shell(/bin/sh)、C shell(/bin/csh)、Korn shell(/bin/ksh) Bourne again shell(/bin/bash)、Tenex(tcsh)。
在ubuntu环境下 /bin/sh -> /dash 在ubuntu中/bin/bash 有时候需要创建符号链接指向bash