• Home
  • Blog
  • tput setaf color, where color is a number from 0 to 7 (try them out to see what colors they…

tput setaf color, where color is a number from 0 to 7 (try them out to see what colors they…

0 comments

tput setaf color, where color is a number from 0 to 7 (try them out to see what colors they represent).

 

To return the terminal to its original color, you can use tput sgr0.

 

Using what we know about shell scripts, write a script that accepts a part of a process name as the first argument (like pgrep), which prints out the PID of all matching processes in blue, which is color code 4. Then print out the number of processes that matched in normal text.

 

If the user doesn’t pass exactly one argument to the script, it should print out the following usage message and exit with a return code of 1:

 

Usage: scriptname pname

Displays all process IDs with image names matching pname.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}