Link to home
Start Free TrialLog in
Avatar of celtician
celticianFlag for American Samoa

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;

Open in new window

Avatar of ozo
ozo
Flag of United States of America image

What value is it returning, and what value should it get?
Did you really want those \?
Did you mean echo or cat?
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tintin
Tintin

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

Open in new window

Avatar of celtician

ASKER

It worked, i only wanted to retrive the value, its an integer.