You are not logged in.
Hi all,
I am using ffmpeg with a time command, I want it to record x amount of second the video input. Therefore I want that command to go on indefinitely unless it failed, then I want the script to execute another command.
But if I use the done after the command it will move to the next command, how to have that command repeated and then move to the following one if it failed?
many thanks for your time and for your input,
Regards,
Offline
Not sure if I get what you want to do, but maybe try break / continue: http://tldp.org/LDP/Bash-Beginners-Guid … 09_05.html
Offline
i'm not sure, if I understood you correctly. Do you want something like this?
while true; do
ffmpeg foobar
if [ $? -ne 0 ]; then # $? contains the exit status of last command
break # exit loop when ffmpeg failed
fi
done
other command
or if the loop should continue if ffmpeg failes:
while true; do
ffmpeg foobar
if [ $? -ne 0 ]; then
other command
fi
done
Offline
No need for the if blocks, just put the test in the while condition.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline