I have an SNMP pass script that I am running and, for some reason that I do not yet understand, additional uses of echo in the script causes the script to not execute. My precise issue right now is that I need to take a substring from a variable, REQ, and assign it to another variable. Below is a method that works in theory, but does not work in my situation due to the use of echo.
DGROUP_NODE=`echo $REQ | cut -d. -f3`
Is there another way to do this without disrupting whatever is reading the script? I have noticed that printf also tends to have the same issue, though less often. (This issue also prevents me from using echo or printf to debug my code...)
NOTES:
When echo causes issues executing the script, no errors are returned (regarding the script). I only get No Such Instance currently exists at this OID which tells me that the script was not run, resulting in my OID tree not being built.
If I run the script outside of SNMP it works as expected.
RET!=REQ, which is it? AND you'll almost always want to dbl-quote variable usage withecho, soecho "$REQ"may solve your problem. Good luck.REQ. I've tried adding quotes already, but the issue is withechoitself. The script works fine when run directly from terminal.