Jump to content


- - - - -

How to create simple program that executes a line of code in terminal?


  • Please log in to reply
3 replies to this topic

#1 Guest_onions_*

Guest_onions_*
  • Guests

Posted 14 December 2015 - 01:59 PM

I'm kind of a noob at programming and haven't managed to wrap my head around it just yet. When I get a solution, it seems blatantly obvious, but I can't figure it out on my own without help...

I often connect to a VPS that I own through terminal and use it to change my IP to something that isn't France for streaming purposes. I've set up my Mac to use a SOCKS proxy with this VPS. The command I run is as follows:

 

ssh -D 5555 [email protected]

 

I am then prompted for my password and enter it.

 

I am a bit lazy and I'd like to do this in one click, or at least have it set up to where all I need to enter is my password. What would be the most effective way to do this? I would imagine a batch file would work very well in Windows, but I don't know anything about OS X since I've only had my Mac for a month now.

 

Thanks in advance!



#2 CheeseMan42

CheeseMan42

    Certified NVIDIA Fanboy

  • News Editor
  • PipPipPipPipPip
  • 4377 posts
  • Gender:Male
  • Location:Bristol, CT

Posted 14 December 2015 - 03:18 PM

You could always set up a public/private key for your local and remote hosts. This will prevent you from having to type a password. Basic gist of it here. Steps should be similar on a Mac as to Linux I think, but at least you know what you are looking for.


i7-6700K @ 4.2GHz | Noctua NH-D14 | MSI Gaming M7 | 2x8GB G.Skill Ripjaws V | GTX 980 Ti | 120GB Samsung 850 EVO M.2 | Corsair 750TX | CM Stacker 830 | SoundBlaster X-Fi Titanium | Sennheiser HD650 + Schiit Magni/Modi 2 + Logitech G430 | Logitech G500s | CM Quick Fire Rapid

Intel i3 NUC | 8GB RAM | Samsung 120GB M.2 || Samsung Chromebook || Google Nexus 7

SteamFor Sale Thread | OCC Steam Group | Follow OCC on facebook.png
Gr4vitas (3/18/09) - So moral of the story is. Vista 64 bit makes me happy in the pants.


#3 Waco

Waco

    Lab Rat 2

  • Reviewer
  • PipPipPipPipPipPipPipPip
  • 16508 posts
  • Gender:Male
  • Location:Los Alamos, NM

Posted 14 December 2015 - 05:34 PM

Just put the command in a script.


Literally put that line in there, chmod +x the file, then you can run it. It'll run by default in your current shell and prompt you like normal.
Tolerance is a sign of weakness.

#4 Guest_onions_*

Guest_onions_*
  • Guests

Posted 14 December 2015 - 11:13 PM

Thanks guys, I ended up figuring it out. Its not a high security thing so I also added a couple lines for it to expect a password and then automatically enter it when prompted.