This shows you the differences between two versions of the page.
Next revision | Previous revision |
vcs:devel:bash_support [2010/03/01 20:08] – created Toni Corvera | vcs:docs:devel:bash_support [2016/04/17 23:28] (current) – ↷ Page moved from dox:vcs:devel:bash_support to vcs:docs:devel:bash_support Toni Corvera |
---|
| |
* ''vcs'' version 1.0.11 included patches to run on bash 2.x but never really worked | * ''vcs'' version 1.0.11 included patches to run on bash 2.x but never really worked |
* **''vcs'' version 1.11 will work on bash 2.05b and higher**, and will be the last version capable of doing so | * **''vcs'' version 1.11 and 1.12 work on bash 2.05b and higher**, 1.12.2 will be the last version capable of doing so, newer versions will require bash 3.1 |
| |
| ====== Development notes ====== |
| |
| ======= Syntax in 2.05b not used ======= |
| |
| References: http://wiki.bash-hackers.org/scripting/bashchanges |
| |
| * ''for <nowiki>((;;))</nowiki>'': C-style for. Loops in bash are *really* slow, an inline AWK loop, is much faster |
| * ''<nowiki>[[ ... ]]</nowiki>'': ''test'' replacement. Builtin with cleaner syntax and parsing, no need to quote, grouping (parentheses), ''&&'' and ''||'' instead of ''-a'' and ''-o'', arithmetic operators (e.g. ''-eq'') force arithmetic evaluation (i.e. <nowiki>[[ 2 -eq "1+1" ]]</nowiki> is true): \\ ''[ "$VAR" = "$X" -a 2 -eq <nowiki>$(( 1+1 ))</nowiki> ]'' -> ''<nowiki>[[ $VAR = $X && 2 -eq '1+1' ]]</nowiki>'' \\ **Pitfall**: When unquoted, the right hand side of a text comparison ('=', '==' and '!=') is considered a pattern ((http://wiki.bash-hackers.org/syntax/ccmd/conditional_expression)) ((http://wiki.bash-hackers.org/syntax/pattern)) |
| |
| ====== Syntax in 3.1 ====== |
| |
| * ''caller'': ''caller 0'' prints the calling function and line |
| * ''<nowiki>[[ =~ ]]</nowiki>'': Pattern matching (right side can be an extended regular expression) ((http://wiki.bash-hackers.org/syntax/ccmd/conditional_expression)) \\ **Pitfalls**: when quoted, it isn't considered an ERE in bash 3.2 and up, but it is in bash 3.1. A variable can be used to get the same behaviour or the shell settings ''shopt compat31'' / ''shopt compat32'' be used. |