#!/bin/sh
echo "one"
read host
echo "two"
read ip
echo "three"
read oid
read oid
echo $oid $host >> logger.txt
it never makes it to echoing “two”
No matter if I pass parameters (this is to receive SNMP traps, and the parameters come) manually in any varied way.
EDIT: This has permissions etc etc, I am testing it by launching it manually, “one” is echoed.
readwaits for input from STDIN.If you do not insert any input by hand (in a interactive terminal) or you do not provide any input from STDIN like this:
it will hang waiting for input
In the example
\nis a newline.If you want to access parameters, do not use
read, but the $1…$n variable.You need this: