I have a Java program that gets two arguments (a video file name and an image) and outputs a boolean (0 or 1) in the first line:
java -jar myProgram video1.mp4 image.png
> 0
>some extra information...
>other extra information....going on
Now using bash script, I need to iterate through all files in a folder (not files in nested folders), run the program with the file name passed to the first argument (video name changes everytime, and image is fixed), and if the output in the first line is 0, copy the file in folder0
, and if the output is 1, copy the file to folder1
.
How can I achieve that in bash?
>
signs part of the output?