scripts: fix binutils-version.sh
[oweals/u-boot.git] / scripts / binutils-version.sh
index d4d9eb43619b331277104564c19c082eff319597..0bc26cf92508b193e6fae49619555d9ecf0cb4ba 100755 (executable)
@@ -14,7 +14,9 @@ if [ ${#gas} -eq 0 ]; then
        exit 1
 fi
 
-MAJOR=$($gas --version | head -1 | awk '{print $NF}' | cut -d . -f 1)
-MINOR=$($gas --version | head -1 | awk '{print $NF}' | cut -d . -f 2)
+version_string=$($gas --version | head -1 | sed -e 's/.*) *\([0-9.]*\).*/\1/' )
+
+MAJOR=$(echo $version_string | cut -d . -f 1)
+MINOR=$(echo $version_string | cut -d . -f 2)
 
 printf "%02d%02d\\n" $MAJOR $MINOR