linux shell scripts
2009-01-10 21:52
344 查看
命令替换和输出捕获 `command` $(command), $()是posix shell的标准, `command`是bash shell的标准。
hard quote 单引号中的所有字符都不被shell解析, soft quote 双引号,部分字符还是会被shell解析(如$), escape / 紧接在反斜线后面的字符是不被shell解析。
fork source exec。挡在command line(主shell)中键入 ./test.sh时,test.sh是以fork方式运行,也就是在sub-shell(子进程)中运行,任何在sub-shell中改变的环境变量只在sub shell中有效对父shell是无效的,除非用export var使其在父 shell中生效。 当以 souce ./test.sh(与. ./test.sh等价,.意味着在本shell中运行)运行时,test.sh是在父shell中运行 ,因此任何在test.sh做的改变都在父shell中生效。exec ./test.sh意味着 test.sh覆盖了父shell。
2)字符串
hard quote 单引号中的所有字符都不被shell解析, soft quote 双引号,部分字符还是会被shell解析(如$), escape / 紧接在反斜线后面的字符是不被shell解析。
fork source exec。挡在command line(主shell)中键入 ./test.sh时,test.sh是以fork方式运行,也就是在sub-shell(子进程)中运行,任何在sub-shell中改变的环境变量只在sub shell中有效对父shell是无效的,除非用export var使其在父 shell中生效。 当以 souce ./test.sh(与. ./test.sh等价,.意味着在本shell中运行)运行时,test.sh是在父shell中运行 ,因此任何在test.sh做的改变都在父shell中生效。exec ./test.sh意味着 test.sh覆盖了父shell。
2)字符串
相关文章推荐
- The linux command line--part 4 Writing Shell Scripts
- 5 Shell Scripts for Linux Newbies to Learn Shell Programming – Part II
- Linux下shell scripts的调试方法小结
- 【Linux】bash shell scripts
- 鸟哥的 Linux 私房菜第13章-学习 Shell Scripts 学习笔记
- linux-shell scripts 脚本的初步认识
- Linux & Shell (2) Write basic shell scripts
- Linux学习-什么是 Shell scripts
- linux source命令与sh shell scripts的区别
- Linux的shell scripts
- Linux的shell scripts的shell脚本练习
- 5 Shell Scripts for Linux Newbies to Learn Shell Programming – Part II
- linux 下shell中if的“-e,-d,-f”是什么意思
- Linux--Shell
- linux的shell(bash)脚本学习
- Linux基础-shell脚本知识整理和脚本编写----------变量、运算符、流程控制、函数、计划任务(发送邮件)
- Linux 下批量创建用户(shell 命令)
- Shell Scripts 简单实战 (二)
- linux在shell中获取时间
- Linux&&shell 总结 一