I'm building a script in bash for use on Linux, and I use the output of a executable to fill parameters:
version=$("${path_exec}" -version | awk '{if($1=="kernel" && $2=="release") print $3}')
patch=$("${path_exec}" -version | awk '{if($1=="patch" && $2=="number") print $3}')
This will run the executable defined in "path_exec" twice, which is time consuming. Is there a way to assign the version and path variable with a value using only one execution of "path_exec"?
An example of what I've tried to tackle this is shown below, but I don't think this will do what I want:
${path_hostexec} -version | awk '{if($1=="kernel" && $2=="release") {version_agent = $3;} else if($1=="patch" && $2=="number") {patch_agent = $3;}}'