Question

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
Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top