Avatar of celtician
celtician
Flag 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

Unix OS

Avatar of undefined
Last Comment
celtician

8/22/2022 - Mon
ozo

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
Gerwin Jansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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

celtician

ASKER
It worked, i only wanted to retrive the value, its an integer.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23