Hacker News new | ask | show | jobs
by taylorlapeyre 4068 days ago
Until Windows supports and supplies bash + the gnu core utils by default, they will have a hard time getting me to switch.
7 comments

Until OSX supports a start menu and powershell by default, they will have a hard time getting me to switch.
Bash scripts run in Powershell. We have hundreds of bash scripts for infrastructure build/deploy/etc. and they are cross-platform. On windows we execute them in Powershell. Powershell's been around for a decade and runs on XP and above (edit: and ships with Windows, I think Win7 and above).

http://en.wikipedia.org/wiki/Windows_PowerShell

http://stackoverflow.com/questions/1098786/run-bash-script-f...

> Bash scripts run in Powershell

...if you install Bash [1] so PowerShell can execute it. In much the same way that batch files can call Bash, or Windows Explorer can if you double click on it.

> A caveat to the accepted answer is that sh is not included in vanilla Powershell. I had to install Git, which optionally adds some UNIX tools to the PATH in Powershell, sh.exe being one of them.

> Note: sh.exe or another *nix shell must be associated with the .sh extension.

[1] http://stackoverflow.com/questions/1098786/run-bash-script-f...

If you find yourself using Windows from time to time, you might try Cmder: http://gooseberrycreative.com/cmder/. It's currently my favorite Unix-like shell on Windows. I've used cygwin and Hamilton C Shell in the past, but Cmder offers, among other things, a console emulator (ConEmu, I gather) that is much better than the default Windows console emulator.
I'd live to see Bash, in a terminal emulator that isn't terrible, with a working .bashrc file, on windows. Sadly they just don't get it.
What's your criteria for a terminal emulator that isn't terrible? I have cygwin running bash with a working .bashrc file in MintTTY and that seems ok?
Protip: Install Git for windows. Then instead of regular cmd console, you can right click on the folder and use "Git bash".

Not full on bash, but you get a better console with ssh, scp and a few other utilities.

You're probably better off installing standalone MSYS with something like mingw-get-installer which also gives you a convenient GUI for installing other common GNU/Unix utilities (and a somewhat crappy command line package manager). It even gives you a half decent terminal (in the form of mintty).

I tend to do most of my windows scripting using bash cause it's just less effort that way. Still, it's not a first class citizen like on Linux, and Microsoft seems to be going down it's own path with powershell (which at best gives a nod to the existence of things like bash, but not a lot more).

I went off the fact that most people caring about some command line on Windows likely also installed Git on it. In that case it is like getting it for free.
I don't we'll eve see gnu core utils (due to licensing), but BSD core utilities would be great though.
I don't think that would be terribly useful, as a bunch of concepts important to Windows the BSD core utilities would have no idea about. Registry, NTFS, etc.

Honestly, I find 'nix users unwilling to learn PowerShell the exact same as Windows user unwilling to learn a 'nix shell and core utilities.

PowerShell doesn't have SED -- but it has pipeline replacement.

  $ cat .\x.txt | %{$_ -replace "sed", "powershell"}
It also has ideas that are completely different... rather than plain text pipe, it has an object pipe, which lets you do stuff like:

  $ ps | sort company | ft ProcessName -groupby company
Which outputs your processes in table format grouped by company, like

  ...
   Company: Greenshot

  ProcessName
  -----------
  Greenshot

   Company: inkscape.org

  ProcessName
  -----------
  inkscape

   Company: IvoSoft

  ProcessName
  -----------
  ClassicStartMenu

   Company: Microsoft Corporation

  ProcessName
  -----------
  taskhostex
  conhost
  explorer
  ...
If you want bash/tools I would suggest Cygwin.