I want the output of the
time command to be shown only if the command, which has been passed to
time was successful. Something like this:
( time wget -pq --delete-after https://www.example.com ) 2>&1 || echo fail
The problem is, that if
wget fails, I still receive the output from
time (which is somewhere logical, as it measures how long it took for the command to fail anyway). My goal is to save the output to a variable and either have
fail in my variable. Does anyone has an idea how I could do this in a decent manner?