celtician
asked on
Not retrieving value correctly in unix
The next sentence is not returing the value it should get:
FROM2= 0;
(ssh machine2 "cat /var/log/syslog* | grep -i \"to=<a@server.com>\" | grep -i sent | grep \"$MONTH \" | cut -c4-6 | grep \" $day_y\" | wc -l") >> $FROM2
echo $FROM2;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Assuming you want
FROM2=$(ssh machine2 "cat /var/log/syslog* | grep -i \"to=<a@server.com>\" | grep -i sent | grep \"$MONTH \" | cut -c4-6 | grep \" $day_y\" | wc -l")
echo $FROM2
ASKER
It worked, i only wanted to retrive the value, its an integer.
Did you really want those \?
Did you mean echo or cat?