Weird make/gmake error
When gmake'ing tools, I started to get strange errors like:
I found that you can grab different version parts from bash in the BASH_VERSINFO array. Well I only really care about major version and this is available in variable BASH_VERSINFO or array element 0 BASH_VERSINFO[0]
I updated my bashrc to check version then load completions:
/bin/bash: complete: command not foundWhat I forget is that I build my own newer bash version (3.x) to be able to use the shell completions (and many other features) and the system default is 2.x. Don't ask about that. But gmake grabs the shell first in your path (older bash in my case).
/bin/bash: /home/users/lcarmich/etc/bash_completion: line 220: syntax error near unexpected token `(('
I found that you can grab different version parts from bash in the BASH_VERSINFO array. Well I only really care about major version and this is available in variable BASH_VERSINFO or array element 0 BASH_VERSINFO[0]
I updated my bashrc to check version then load completions:
if [ -r $BASH_COMPLETION -a $BASH_VERSINFO -ge 3 ]; thenFor future reference you can get array elements in bash with ${VARNAME[INDEX]}. For example:
. $BASH_COMPLETION
fi
mnsdev11 (netcat-0.7.1)$ echo $BASH_VERSIONDone.
3.2.0(1)-release
mnsdev11 (netcat-0.7.1)$ echo $BASH_VERSINFO
3
mnsdev11 (netcat-0.7.1)$ echo ${BASH_VERSINFO[0]}
3
mnsdev11 (netcat-0.7.1)$ echo ${BASH_VERSINFO[1]}
2
mnsdev11 (netcat-0.7.1)$ echo ${BASH_VERSINFO[2]}
0
mnsdev11 (netcat-0.7.1)$ echo ${BASH_VERSINFO[3]}
1
mnsdev11 (netcat-0.7.1)$ echo ${BASH_VERSINFO[4]}
release
Comments
Post a Comment