Home Download Buy Blog Forum Support

Running commands via ST2 (such a sudo etc) on windows?

Running commands via ST2 (such a sudo etc) on windows?

Postby ausprog on Sun Oct 14, 2012 8:05 am

Hey!
Been evaluation ST2 for a while, and recently started getting into programming (to make a career of it).

I've been following a lot of tutorials for coding and so many of them refer to using OSX / unix based command line, and being on windows none of these commands work so I'm stuck scratching myself wishing i had a different OS (though i like windows for the most part otherwise).

Is it possible to get some sort of interpreter that plugs into ST2 and will run these commands for me via the ST2 command line? So far I've only done something like this to allow myself to make ST2 my SQL editor (rather than the horrible command line in windows).

Would be great if this was possible. Love the community and the support for this software.

Hopefully i hear back some good news, though I understand if this isn't possible.

Also apologies if this has been asked before. I don't really know what to ask myself, so Googling for it yielded no results on my queries.
ausprog
 
Posts: 13
Joined: Sun Oct 14, 2012 7:58 am

Re: Running commands via ST2 (such a sudo etc) on windows?

Postby iamntz on Sun Oct 14, 2012 8:32 am

What kind of commands do you want to run?

sudo is not available on non unix-like machine...
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Running commands via ST2 (such a sudo etc) on windows?

Postby ausprog on Sun Oct 14, 2012 8:45 am

Any commands that would register on unix based machine (if that makes sense, though afaik that covers osx and linux dist.'s).

I was hoping there was an interpreter or something else that worked in ST2 and I could perhaps Build the file and run it as unix or something (much like i have made a build to run mysql commands from ST2). However I realise mysql is openly available on windows where these unix commands aren't (to my knowledge), so its sort of a double-step to get where i want.

commands would be like: ls (list directory), mv (move) and so on, you know the basic ones. I know windows features similar commands for the same function, though I'm just trying to bring the CLI of unix to windows.

A better example would be me trying to install composer (from getcomposer.org). They don't have an installer and instead require commands to be run, for instance:
Code: Select all
$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer


I can't run that on a windows command line, but i was hoping there was some interpreter / build i could use where i just throw the code into a ST2 file, Build it and then it simply runs the code through whatever-plugin-that-does-the-job.

Thanks~

Edit: I'll add that i have composer installed, I'm using the composer reference as exactly that. This is so as when I continue following tutorials and need to install particular applications I can so by following the guide, rather than hitting a roadblock limited by my OS.
ausprog
 
Posts: 13
Joined: Sun Oct 14, 2012 7:58 am

Re: Running commands via ST2 (such a sudo etc) on windows?

Postby iamntz on Sun Oct 14, 2012 8:58 am

You could use Cygwin which brings some of the unix commands to windows. Not sure how to run them from sublime though...

However, you might want to fiddle around for each command, since most of them have windows alternatives. Eg:
- curl is available on windows 7 (built in afaik) and accepts most of the params of the linux versions
- the second command will make composer available on PATH variable, so you could just type `composer` in cmd prompt and make it work. For this, you can press win+pause > advanced system settings > environment variables > search for PATH variable and select it > add new path at the end hit save and you are done.

However, if you have more commands that you can't use on windows, probably it's a better idea to move to linux (or just install as virtual box/vagrant and use it there)
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Running commands via ST2 (such a sudo etc) on windows?

Postby ausprog on Sun Oct 14, 2012 9:04 am

I was doing some more digging around and came across coreutils which allows me to now run unix commands from CMD!

Now I'll just make a sublime build for the command line and it should interpret everything correctly (lets hope anyway).

If this doesn't work out though I'll give Cygwin a go too (may just do so anyway to see how it compares). I'll play around with those environment paths as well to make things easier. I remember trying years ago and didn't follow through with it to succession, but I'm sick of basic commands not working unless I'm in the directory so I'll be setting that up now too.

I'll come back and update on how things have turned out.
Thanks.
ausprog
 
Posts: 13
Joined: Sun Oct 14, 2012 7:58 am

Re: Running commands via ST2 (such a sudo etc) on windows?

Postby tobalsan on Sun Oct 14, 2012 12:25 pm

I suggest using Gow, which is way lighter than Cygwinm yet giving you access to 130+ linux commands right inside Windows CMD. You get access to all of these commands:

agrep, ansi2knr, basename, bash, bc, bison, bunzip2, bzip2, bzip2recover,
cat, chgrp, chmod, chown, cksum, cmp, comm, compress, cp, csplit, curl,
cut, cvs, dc, dd, df, diff, diff3, dircolors, dirname, dos2unix, du,
egrep, env, expand, expr, factor, fgrep, flex, fmt, fold, fsplit,
gawk, gclip, gow, gplay, grep, gsar, gunzip, gzip, head, id, indent,
install, join, jwhois, less, lesskey, ln, logname, ls, m4, make,
md5sum, mkdir, mkfifo, mknod, mv, mvdir, ncftp, nl, od, pageant,
paste, patch, pathchk, pclip, plink, pr, printenv, printf, pscp,
psftp, putty, puttygen, pwd, recode, rm, rman, rmdir, scp, sdiff,
sed, seq, sftp, sh, shar, sleep, sort, split, stego, su, sum,
sync, tac, tail, tar, tee, test, touch, tr, type, uname, unexpand,
uniq, unix2dos, unrar, unshar, unzip, uudecode, uuencode, vim, wc,
wget, whereis, which, whoami, xargs, yes, zcat, zip
tobalsan
 
Posts: 6
Joined: Tue Oct 02, 2012 11:28 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 29 guests