Jump to content
Sign in to follow this  
Guest onions

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

Recommended Posts

Guest onions

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Guest onions

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×