how to create a bash script that creates a bar graph in the terminal window
Hey, I just want to know how you would go about making a bash script that creates a bar graph in the terminal window. This is a real time bar graph of cpu load average times that updates at a specified interval. I know you use the uptime command but not completely sure how to go about making the bar graph. Any help would be appreciated, thanks.
|
xload does a graph.
|
Ya I know but xload does a histogram, not a bar graph.
|
|
bar makes a progress bar. gnuplot may have such functionality. In any event, you're probably looking for a ncurses-based program, if that helps narrow the search.
|
|
https://scs.senecac.on.ca/~john.selm...123/ass02.html
The output should look something like this. The colours aside, I just want to know how you would code a bar graph like that to run in the terminal. |
Well, if that page is from the actual course, then clues have been provided about how to achieve this goal.
"Linux commands which display the load average include uptime, w, top and xload" ... "Hints: besides viewing the man pages for uptime, w, top and xload you may want to investigate"
|
Quote:
|
"For this assignment you will design and code a new BASH command (script) named "cload". The purpose of "cload" is to display a colourful bar graph, in a terminal window, of the three Linux load averages in "real" time. The three load averages are the 1 minute average, the 5 minute average and the 15 minute average."
It does NOT say you have to create the bar graph in bash, it says "display a colourful bar graph, in a terminal window". I know what it looks like he's asking. There are variables I am not aware of, sorry. Back on task, what have you coded so far? |
Quote:
Otherwise, make it more clear with specific details what you're asking. |
All times are GMT -5. The time now is 07:09 PM. |