0

I am trying to evaluate the following regex in bash,

[[ build: =~ ^([[:space:]]*build) ]]

This line is throwing error as,

malloc: shmatch.c:115: assertion botched
free: start and end chunk sizes differ
Aborting...ABORT instruction (core dumped)

Is there any fix for this?

The entire code snippet is

 echo $line : $val;
 if [[ "$line" =~ ^([[:space:]]*build) ]]
     then
            build=$val
 fi

this is the code snippet, basically there are 2 variables line and val I wanted to assign value of $val to variable build if the $line starts with "build". e.g. if $line is "build=20" and $val is "35" then I want value of $build equal to 35.

I am using HP-UX 11.31 if this is relevant..

Abhijeet
  • 1
  • 1
  • Welcome to SO, thanks for showing your efforts. Please post samples of input and expected output in your question to make it more clear, thank you. – RavinderSingh13 Dec 16 '21 at 07:26
  • 1
    A failing assertion is pretty always a bug in bash. BTW, it works fine in my bash (version 4.4.12). Could even be a bug particular to the HP-UX bash port. – user1934428 Dec 16 '21 at 07:42
  • @user1934428, ohh ok.. Will check that.. – Abhijeet Dec 16 '21 at 07:45

0 Answers0