This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
bash_mix [2010/11/11 13:31] Jan Stancek |
bash_mix [2011/09/20 20:43] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | \\ | ||
+ | http://tldp.org/LDP/abs/html/\\ | ||
+ | \\ | ||
+ | <code> | ||
+ | echo ${PATH#*:} # Parameter substitution, not a comment. | ||
+ | echo $(( 2#101011 )) # Base conversion, not a comment. | ||
+ | echo ${param1:-DEFAULT} | ||
+ | echo "whatever" | cat - | ||
+ | file - | ||
+ | let "z = 5 % 3" | ||
+ | echo ~+ | ||
+ | a="23456"; echo ${a/23/BB} | ||
+ | echo $(ls -l) | ||
+ | type '[' | ||
+ | type '[[' | ||
+ | echo $((RANDOM%16)) | ||
+ | str="123abc"; echo ${#str}; expr length $str; expr "$str" : '.*' | ||
+ | expr match "$string" '$substring' | ||
+ | expr "$string" : '$substring' | ||
+ | echo ${str:2:3} | ||
+ | echo ${*:2}; echo ${@:2} | ||
+ | expr match "$string" '\($substring\)' | ||
+ | expr "$string" : '\($substring\)' | ||
+ | ${string#substring} | ||
+ | ${string##substring} | ||
+ | ${string%substring} | ||
+ | ${string%%substring} | ||
+ | ${string/substring/replacement} | ||
+ | ${string//substring/replacement} | ||
+ | ${string/#substring/replacement} | ||
+ | ${string/%substring/replacement} | ||
+ | echo ${parameter-default}; ${parameter:-default} | ||
+ | ${parameter=default}; ${parameter:=default} | ||
+ | ${parameter?err_msg}, ${parameter:?err_msg} | ||
+ | ${var#Pattern}, ${var##Pattern} | ||
+ | ${var%Pattern}, ${var%%Pattern} | ||
+ | |||
+ | |||
+ | |||
+ | </code> |