I am running bash 5.0.007-1 and net-snmp 5.8-2 on an up to date arch linux.
This line collects the status of a device:
snmpstatus -c public -v1 192.168.1.240
When the device is not powered on, ie the above ip address does not exist on the network, the above command returns the below output to the terminal:
Timeout: No Response from 192.168.1.240
How do I stop this timeout output line displaying in the terminal and capture it to a variable instead. Also if the device is switched on and the ip address exists normal output should be displayed on the terminal as well as passing output to the same variable.
I will parse the variable once I have it and decide what to do depending on its contents.
(I have done a fair bit of reading including
man smnpwalk and on re-direction but the solution is evading me).