bash中的括号
2004-08-12 17:51
155 查看
(list)
list将在一个子shell中被执行, 不会对当前shell产生影响
返回list的exit值
{ list; }
可以作组合命令用
list将在当前shell中被执行
list结尾处必须要有新行或';'号
返回list的exit值
list前后必须有空格
((expression))
算术计算
${!p} 二重参数
${!p*} 返回所有以p开头的变量
${p:-word} 如果变量p不存在,返回"word"
${p:=word} 如果变量p不存在,返回"word",并将p的值设为"word"
${p:?word} 如果变量p不存在,将"word"打入STDERR
${p:+word} 如果变量p存在,返回"word"
${p:2} 子串
${p:2:3} 子串
${p#pattern} 返回p开头删除pattern后的字符串,非贪婪模式
${p##pattern} 返回p开头删除pattern后的字符串,贪婪模式
${p%pattern} 返回p结尾删除pattern后的字符串,非贪婪模式
${p%%pattern} 返回p结尾删除pattern后的字符串,贪婪模式
${p/pattern/word} 用"word"替换pattern,pattern前可加#或%,表开头或结尾
${p//pattern/word} 用"word"替换所有pattern,pattern前可加#或%,表开头或结尾
${<file} 返回文件内容
$((expression)) 返回数学表达式的值
${ list; } 返回命令执行之输出
list将在一个子shell中被执行, 不会对当前shell产生影响
返回list的exit值
{ list; }
可以作组合命令用
list将在当前shell中被执行
list结尾处必须要有新行或';'号
返回list的exit值
list前后必须有空格
((expression))
算术计算
${!p} 二重参数
${!p*} 返回所有以p开头的变量
${p:-word} 如果变量p不存在,返回"word"
${p:=word} 如果变量p不存在,返回"word",并将p的值设为"word"
${p:?word} 如果变量p不存在,将"word"打入STDERR
${p:+word} 如果变量p存在,返回"word"
${p:2} 子串
${p:2:3} 子串
${p#pattern} 返回p开头删除pattern后的字符串,非贪婪模式
${p##pattern} 返回p开头删除pattern后的字符串,贪婪模式
${p%pattern} 返回p结尾删除pattern后的字符串,非贪婪模式
${p%%pattern} 返回p结尾删除pattern后的字符串,贪婪模式
${p/pattern/word} 用"word"替换pattern,pattern前可加#或%,表开头或结尾
${p//pattern/word} 用"word"替换所有pattern,pattern前可加#或%,表开头或结尾
${<file} 返回文件内容
$((expression)) 返回数学表达式的值
${ list; } 返回命令执行之输出
相关文章推荐
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
- BASH 中单括号和双括号
- bash 括号(小括号,双小括号,中括号,双中括号,大括号)
- shell脚本学习之Bash shell 里各种括号的用法
- BASH 中单括号和双括号
- bash之花括号展开(brace expansion)
- Bash Shell 里的各种括号
- shell脚本学习之Bash shell 里各种括号的用法
- bash下的单方括号和双方括号
- BASH 中单括号和双括号
- bash 括号(小括号,双小括号,中括号,双中括号,大括号)
- bash中:单引号,双引号,反引号``,小括号,中括号,和大括号的区别
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
- fw: bash中的括号
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
- BASH命令和SHELL脚本总结(6)括号篇
- linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别