Check he or she is login
check he or she is login or not the user after every 1 minute
The UNIX operating system is a set of programs that act as a link between the computer and the user. The computer programs that allocate the system resources and coordinate all the details of the computer’s internals is called the operating system or kernel. Users communicate with the kernel through a program known as the shell. The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel.
We know UNIX is a computer Operating System which is capable of handling activities from multiple users at the same time. If this system is used by multiple user and we want to check that a user is login or not or in every minute then that question is good to do because the question is mine.
So let’s code
#!/bin/bash
read -p "Enter the name of your friend: " name
ch=`who | grep "$name"`
until [ -z ch ]; do
sleep 1s
echo "Waiting..."
done
For more Linux questiom
Output will be:
All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme