This is a multipart blog article series where I am going to explain the concepts of shell scripting and how to write a shell script in Linux, UNIX or Mac based systems. You can also follow this tutorial blog using windows but for that you have to install a bash from.
In this article we will see that how can we use sleep system call using while loop, and how can we open terminal using while loop in shell script.
- Sleep command:
- If you want to pause the execution of the loop for a while then you can use
sleep
command. - Sleep
1
will pauses the execution of the loop for1
second. n=1 while [ $n -le 3 ] do echo "$n" (( n++ )) sleep(1) done
- If you want to pause the execution of the loop for a while then you can use
- Open terminal:
- We can open the terminal using the while loop in the shell script.
- In the loop if we write
gnome-terminal &
then the terminal which is present in GNOME desktop will get open. n=1 while [ $n -le 3 ] do echo "$n" (( ++n )) gnome-terminal & done
Reference code file for this article
So this was all about how to use sleep command and how to open terminal using while loop in shell script. Hope you liked it and learned something new form it.
If you have any doubt, question, quires related to this topic or just want to share something with me, than please feel free to contact me.
๐ฑ Contact Me
Twitter, LinkedIn, Telegram, Instagram,