- All right, let's write a script.
What do we need to do?
The script should prompt for the user to enter a color
and the name of this color should be stored in a variable.
And the script should loop in such a way
that every 10 seconds, it'll prompt for the message,
"The color is on screen"
and ensure that instead of whatever,
the actual color name is printed.
Start the script in a way that it takes a lower priority
than other processes running on your computer.
Okay, let's do it.
So I'm calling this script color.sh.
The assignment is not mentioning any names,
so I'm figuring out something myself.
A script should always start with shebang,
so there we go.
And then, "echo enter a color".
"read COLOR".
That will create the variable that the user is entering.
And then we need the script to loop
in such a way that every 10 seconds,
it'll prompt a message "The color is".
So "while sleep 10,
do
echo the color is $COLOR
done."
That seems to be it.
And then we need to start a script
in such a way that it takes a lower priority
than all the processes running on your computer.
So, let's first make it executable,
"chmod + x color.sh"
and then let's use "nice 19 color.sh".
Oops, my mistake.
That's why you should always check some help
if you don't use it on a regular basis.
And let me use "nice minus minus help"
to see what we need to do.
Ah, "nice minus minus n"
followed by the 19.
So, we were almost there.
And then it's giving me an error,
"No such file or directory"
because color.sh isn't the current directory.
But now we are good.
So we need to wait for 10 seconds.
And there we go.
The color is blue.
Feel free to wait another 10 seconds to verify
that the while loop is doing what you expected to do.
I would really advise you to see at least twice
that it's working all right.
Three times, if that makes you feel better.
And if you're seeing it three times,
then, you should be okay.
Right, that's all.