Bash versions support

The main bash version targeted is the 3.x line and generally won't work in older versions.

  • vcs version 1.0.11 included patches to run on bash 2.x but never really worked
  • 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 ((;;)): C-style for. Loops in bash are *really* slow, an inline AWK loop, is much faster
  • [[ ... ]]: 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. [[ 2 -eq "1+1" ]] is true):
    [ “$VAR” = “$X” -a 2 -eq $(( 1+1 )) ][[ $VAR = $X && 2 -eq '1+1' ]]
    Pitfall: When unquoted, the right hand side of a text comparison ('=', '==' and '!=') is considered a pattern 1) 2)

Syntax in 3.1

  • caller: caller 0 prints the calling function and line
  • [[ =~ ]]: Pattern matching (right side can be an extended regular expression) 3)
    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.

All dates/times in this page are UTC.
  • vcs/docs/devel/bash_support.txt
  • Last modified: 2016/04/17 23:28
  • by Toni Corvera