6

I want to set up port forwarding with ssh like so:

ssh [email protected] -L 5656:remoteserver:80 -N

and then run a curl command:

curl http://localhost:5656/my/endpoint/

I can accomplish this just fine using two commands, but how can I combine them into a single working command?

I'm on OSX if that matters.

tmatti
  • 63
  • 1
  • 1
  • 4

1 Answers1

7

Do you really need to do both of the things? Would not be easier to curl on the remote server and pull the result without port forwarding, such as

ssh [email protected] curl http://remoteserver/my/endpoint/ -o - > result
Jakuje
  • 20,974
  • 7
  • 51
  • 70