[SOLVED] Save output of command to a variable
by GPGAgent from LinuxQuestions.org on (#5GCR9)
I have a script to display the video name and it's height.Code:$ for ff in *.mp4; do echo "$ff"; mediainfo --Inform="Video;%Height%" "$ff"; echo "============";done
What I would like to do is to pipe this to a file if the height is 720 or more, but I can't quite get how to do this.
I need to check the result of Code:mediainfo --Inform="Video;%Height%" "$ff"where ff is the video file being processed by mediainfo
Obviously Code:mediainfo --Inform="Video;%Height%" test.mp4 > Hjust creates a file H with 720 in it.
I don't know how to assign the result of the mediainfo command to a variable I can check inside the script with an if construct.
It's probably obvious but not to me!


What I would like to do is to pipe this to a file if the height is 720 or more, but I can't quite get how to do this.
I need to check the result of Code:mediainfo --Inform="Video;%Height%" "$ff"where ff is the video file being processed by mediainfo
Obviously Code:mediainfo --Inform="Video;%Height%" test.mp4 > Hjust creates a file H with 720 in it.
I don't know how to assign the result of the mediainfo command to a variable I can check inside the script with an if construct.
It's probably obvious but not to me!