Frage

I want to know what is this command do?

In addition, the 'who | grep > /dev/null' in this loop why must return true or false:

until who | grep “Milad” > /dev/null
do
   sleep 60
done
War es hilfreich?

Lösung

This will wait until a user named "Milad" is logged in.

who gets the list of logged in users, grep "Milad" filters the list returned by who for entries that contain Milad. This will return "true" if the entry was found. To suppress any output, it is redirected to the digital toilet (> /dev/null). The whole thing then loops while there is no user Milad, sleeping 60 seconds between each test.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top