On a Linux machine I have a series of commands that offer numerical values of the state of different sensors.
The call of these commands is something similar to the following:
$ command1 5647 $ command2 76 $ command3 8754
These values change in real time, and every time I want to check the status of one of them, I have to re-launch the command... This doesn't do me any good since I need both hands to manipulate the hardware.
My goal is to make a simple Bash Script that calls these commands and keeps the value updated (in real time asynchronously or refreshing the value every x seconds) like this:
$ ./myScript.sh command1: x command2: y command3: z command4: v
v are the changing values.
Bash allows this simply and efficiently? or should I choose to do it in another language, like Python?
UPDATE with more info:
My current script is:
#!/bin/bash echo "Célula calibrada: " $(npe ?AI1) echo "Anemómetro: " $(npe ?AI2) echo "Célula temperatura: " $(npe ?AI3) echo "Célula temperatura: " $(npe ?AI4)
npe being an example command that returns the numeric value. I expect an output like this:
This output I get with the command
watch -n x ./myScript.sh, where
x is refresh value of seconds. If I edit my script like this:
#!/bin/bash while sleep 1; do clear; # added to keep the information in the same line echo "Célula calibrada: " $(npe ?AI1); echo "Anemómetro: " $(npe ?AI2); echo "Célula temperatura: " $(npe ?AI3); echo "Célula temperatura: " $(npe ?AI4); done
I get my output with an annoying flicker: