I try to run this script against a remote machine, to carry out login check, but have some problems executing it with no errors. I have the following error when I run the script: The Error:
bash: -c: option requires an argument
bash: line 2: [: missing `]'
The Shell Script:
#!/bin/bash
ssh root@192.168.88.20 bash -c '
radtest user password 127.0.0.1 100 testing | grep 'Access-Accept' &> /dev/null
if [ $? == 0]; then
echo "match"
fi
'
Any ideas what could cases the error? Note: ssh doesn't need a password here.
if radtest user password 127.0.0.1 100 testing | grep -q "Access-Accept"; then ...
– muru Feb 17 '15 at 23:17