0

How do I use system() and feed it prompted responses? My responses do not change and so if I can set them once in a txt file or other place that is fine as well.

At the command line, I run the following line to connect to a vpn:

/opt/cisco/anyconnect/bin/vpn -s connect web.site.net <<"EOF"

and this prompts 5 lines which I respond to and then it logs into the VPN:

domain
user
password
exit
EOF

When I try to do the same with a system() call in R, I tried this but no joy:

system('/opt/cisco/anyconnect/bin/vpn -s connect web.site.net <<"EOF"'; "domain"; "user"; "password"; "exit"; "EOF"')

Thank you for reading.

  • Can't you just pipe in a file with those inputs instead of using `"EOF"`, e.g, `/opt/cisco/anyconnect/bin/vpn -s connect web.site.net < config-file.txt`? – nrussell Feb 23 '16 at 23:43
  • Thanks nrussell. I get the same error message back: `>> state: Disconnected >> error: Connect not available. Another AnyConnect application is running or this functionality was not requested by this application.` – user3693572 Feb 23 '16 at 23:58

1 Answers1

-1

First you can create a file with information you need here. Then run it from within the R shell by using system("expect yourFile.sh")

Community
  • 1
  • 1
polka
  • 1,383
  • 2
  • 25
  • 40