Repeat terminal command until specified output

Set a condition for the while loop

If you replace

while true

by:

while [ "$(dropbox status)" != "Up to date" ]

it works as you describe.

The command

To stop/start Dropbox and finish after synchronizing is done becomes then:

dropbox stop && dropbox start && while  [ "$(dropbox status)" != "Up to date" ]; do dropbox status; sleep 1; done

Or better (to prevent doubling dropbox status):

dropbox stop && dropbox start && while  [ "$(dropbox status)" != "Up to date" ]; do echo "Updating"; sleep 1 ; done && echo "Finished"

Explanation

while true is waiting for a break condition inside the loop (which never comes), but while [ "$(dropbox status)" != "Up to date" makes the loop break if dropbox status returns Up to date


As Jacob says, use the condition on the loop. I suggest an until loop:

dropbox stop && dropbox start && 
until dropbox status | grep -q "Up to date";
do 
  sleep 1; 
done

until runs until the command returns true, that's when dropbox status output contains Up to date.