Following is the output of my Unix command
$ /data/nagios/libexec/check_http -I example.com -C 30 -p443 --sni
OK - Certificate 'example.com' will expire on 05/10/2020 12:00.
But when I do a grep on the output inside a script,it shows "No such file or directory"
grep: OK - Certificate 'example.com' will expire on 05/10/2020 12:00.: No such file or directory
Below is the script
#!/bin/bash
output=`/data/nagios/libexec/check_http -I example.com -C 30 -p443 --sni`
grep 'OK' "$output"
Can anybody please guide how to resolve this. It works fine when I execute directly on commandline
$ /data/nagios/libexec/check_http -I example.com -C 30 -p443 --sni | grep OK
OK - Certificate 'example.com' will expire on 05/10/2020 12:00.