kusnier/vagrant-persistent-storage

bash 3.1 incompatible

HenryNe opened this issue · 0 comments

The script is not compatible for bash 3.1
error:

/tmp/disk_operations_data.sh: line 3: unexpected argument (' to conditional binary operator /tmp/disk_operations_data.sh: line 3: syntax error near (['
/tmp/disk_operations_data.sh: line 3: `[[ $("sfdisk" --version) =~ ([0-9][.][0-9.][0-9.]) ]] && version="${BASH_REMATCH[1]}"'

To fix that, the brakes around regular expression should remove and use simple full match.

-[[ $("sfdisk" --version) =~ ([0-9][.][0-9.]*[0-9.]*) ]] && version="${BASH_REMATCH[1]}"
+[[ $("sfdisk" --version) =~ [0-9][.][0-9.]*[0-9.]* ]] && version="${BASH_REMATCH}"

see comments in http://mywiki.wooledge.org/BashGuide/Patterns#line-114