Skip to main content
edited title
Link
Gazel
  • 133
  • 1
  • 9

Shell script problem: Two errors when running ssh in a bash: -c: option requires an argument script

Post Closed as "Duplicate" by Gilles 'SO- stop being evil' bash
Source Link
Gazel
  • 133
  • 1
  • 9

Shell script problem: bash: -c: option requires an argument

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 [email protected] 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.