I would like to do a set of operations (x y z) as long as I have at least 200MB free space on file-system mounted to /media/z.
How can I do that?
I tried something like
while (`df | grep /media/z | awk '{print $4}'` > 204800); do x; y; z; done;
but I guess my while syntax is wrong.
( ) executes a command in a sub-shell. If you want to test a condition you have to use test command: [ ].
while [ `df | grep /media/z | awk '{print $4}'` -gt 204800 ]; do 
    x; y; z; sleep 5; 
done;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With