I\'m trying to write a bash script that increments the version number which is given in
{major}.{minor}.{revision}
For example.
<
I use the shell's own word splitting; something like
oIFS="$IFS"
IFS=.
set -- $version
IFS="$oIFS"
although you need to be careful with version numbers in general due to alphabetic or date suffixes and other annoyingly inconsistent bits. After this, the positional parameters will be set to the components of $version
:
$1 = 1
$2 = 2
$3 = 13
($IFS
is a set of single characters, not a string, so this won't work with a multicharacter field separator, although you can use IFS=.-
to split on either .
or -
.)