I have an automation script that I'm writing in Bash. I need to execute a perl script from within this and capture/parse one specific part of it's output and use it as a variable in order to complete the bash script's tasks.
For example:
echo "Creating database for "$custname
perl /home/dib/testing/addCustomer.cgi name=$custname prefix=$customerno
The perl script "addCustomer.cgi" will return JSON output of:
Content-Type: application/json; charset=UTF-8
{
   "recordcount" : 1,
   "status" : "OK",
   "statusText" : "Add Customer: 40:Testing",
   "customer" : [
      {
         "address" : "",
         "city" : "",
         "country" : "US",
         "description" : "",
         "email" : "",
         "endDate" : "0000-00-00 00:00:00",
         "frontendurl" : "",
         "phone" : "",
         "prefix" : "testing",
         "startDate" : "0000-00-00 00:00:00",
         "state" : "",
         "customerID" : "40",
         "subscriberName" : "Testing",
         "url" : "",
         "zip" : ""
      }
   ],
   "timestamp" : 1559163419
}
What I need to capture is the customerID number, stick it into a variable, and use it to finish the bash script. Is something like this possible? I always see parsing or passing from bash to perl but not the other way around.
 
    