I must connect to server every day by ssh, and I made a script to display logs.
This is my code:
#!/bin/bash
A=`date +%Y`
M=`date +%m`
D=`date +%d`
gnome-terminal --geometry=82x11 \
--tab --title "NAMEServer" -e "sshpass -p P4ssw0rd ssh [email protected] 'tail -f /opt/logs/example.$A-$M-$D.log'" \
--tab --title "NAMEServer" -e "sshpass -p P4ssw0rd ssh [email protected] 'tail -f /opt/logs/example.$A-$M-$D.log'"
But if I try filter a words with grep, not working. Example:
-e "sshpass -p P4ssw0rd ssh [email protected] 'tail -f /opt/logs/example.$A-$M-$D.log | grep 'not fetch''" \
or
-e "sshpass -p P4ssw0rd ssh [email protected] 'cat /opt/logs/exaple.log | grep 'any problem''" \
I think the problem is the quotation marks, but, which use?, I tried with ´´ ' ' " "
.