I have multiple C programs I'm trying to run from my bash script. I know how to run the programs from the script but one of the programs takes arguments that are the output from another program. I need to run a program "dimensions" to find the dimensions of an image. Then I need to use those dimensions to crop an image into 4 quadrants.
What I have is below:
imageDirect=$1 imageOutput=$2 for file in "$imageDirect"/*; do "./dimensions" "$file" "-v" imageWidth=? imageHeight=? cropWidth=imageWidth/2 cropHeight=imageHeight/2 #what lower left quadrant crop call would be "./crop" "$file" "$imageOutput" "0" "0" "$cropWidth" "$cropHeight" done
The output of dimensions will look like
256 256 where the first number is the width and second is the height. The line with
./crop is just to give an idea of what I'm doing.
The only thing I'm not sure of is how to get the output from
dimensions and store both numbers in separate variables in my script.