By jj2593

2019-10-14 22:07:58 8 Comments

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:


for file in "$imageDirect"/*; do
  "./dimensions" "$file" "-v"


  #what lower left quadrant crop call would be
  "./crop" "$file" "$imageOutput" "0" "0" "$cropWidth" "$cropHeight"


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.


Related Questions

Sponsored Content

66 Answered Questions

[SOLVED] How to get the source directory of a Bash script from within the script itself

  • 2008-09-12 20:39:56
  • Jiaaro
  • 1711051 View
  • 4945 Score
  • 66 Answer
  • Tags:   bash directory

14 Answered Questions

[SOLVED] How do I set a variable to the output of a command in Bash?

28 Answered Questions

[SOLVED] Pipe to/from the clipboard in Bash script

16 Answered Questions

[SOLVED] How to use SSH to run a shell script on a remote machine?

35 Answered Questions

[SOLVED] How can I check if a program exists from a Bash script?

  • 2009-02-26 21:52:49
  • gregh
  • 684450 View
  • 2205 Score
  • 35 Answer
  • Tags:   bash

10 Answered Questions

[SOLVED] How to get a password from a shell script without echoing

  • 2010-10-20 17:33:28
  • BD at Rivenhill
  • 348310 View
  • 422 Score
  • 10 Answer
  • Tags:   bash shell scripting sh

7 Answered Questions

[SOLVED] How can I suppress all output from a command using Bash?

8 Answered Questions

[SOLVED] How does "cat << EOF" work in bash?

5 Answered Questions

Sponsored Content