Ask HN: Why hasn't anyone made a bash-like shell that directly targets Windows?

11 points by brundolf ↗ HN
I get that some aspects of bash and friends are wrapped up in Unix/GNU/etc, but not everything. It seems like there are lots of core commands and basic interaction features, and maybe even some things like Linux-style piping, that could be replicated on Windows without bridging the entirety of the Linux system interfaces for 100% compatibility (like WSL does).

Why isn't there a native Windows shell out there that's just designed to be comfortable-enough for bash users, in the low-hanging ways?

23 comments

[ 3.7 ms ] story [ 41.3 ms ] thread
You mean like https://www.cygwin.com/ ?
The way Cygwin is implemented is a bit different from what I mean. My thinking is a shell that doesn't even try to be binary-compatible, it only tries to be "UI"-compatible
That makes no sense. Please try to rephrase.
Tab-autocomplete works the same way

Command-history works the same way

Pipes and angle bracket operators work the same way

Setting env variables inline works the same way

All the familiar basic commands for getting around (cd, ls, cat, etc) are present and work the same way (same flags, same output format, etc)

All the little things that trip you up when you just try and use cmd.exe to do something simple would work the way you expect them to from bash. Everything that doesn't translate falls back to the normal Windows behavior. 80% of the benefit, 20% of the effort/complexity

No idea what that would take, I haven't had the honour of working in a windows environment in a decade.
probably because most "use of bash" in practice rapidly reduces to "use of a subset of the unix toolset" which doesn't exist in the same environment, so -- just the bash shell itself on its own -- would be like a fish out of water.
What about including a "busybox for windows"? Just the core utilities. Common dev tools like git and node already have command-line versions for Windows that work pretty much the same as the other versions
Well, now there’s WSL 1 and/or 2 depending on your needs. Once hardware GPU support goes live, there are not a ton of development software that one of those could not handle. If you want to do stuff with the windows os or applications, powershell is actually quite good and offers some real advantages over bash - for example, In powershell everything is an object, no string nonsense like bash.
WSL 1 attempts to bridge all of the Linux system APIs over to Windows ones. WSL 2 spins up an entire Linux VM. Both come with nontrivial compromises when it comes to interop

Powershell seems like it tries to change some things up for the "better", but what I really want is something where a person who's used to Unix can just pop into Windows and hit the ground running with all the basic stuff without having to learn a "new" shell first

If we're talking about native (i.e. not using Cygwin or MSYS) shells, I believe Hamilton C Shell is the closest thing: https://hamiltonlabs.com/Cshell.htm

It has some drawbacks, though, most notably lack of Unicode support.

That looks like the right idea! Though unfortunately it appears to be closed-source, and the last update was in 2014
I'd thought this would be useful but not a complete solution, but then noticed it looks like it includes its own shell?

> The BusyBox shell is based on ash. It strives to be POSIX-compatible, though it does support some features of bash. A UNIX-style shell is something like the Windows command prompt, though much more powerful. It can be used as an interactive command line or to run shell scripts (like Windows batch files, though again, much more powerful).

Yes. The shell in BusyBox is derived from ash via dash. They have diverged over the years but there is some flow of patches between the two. While dash aims to be POSIX-compatible the BusyBox shell includes selected bash features.

The shell in the busybox-w32 port has much of the POSIX and bash goodness of upstream BusyBox. It's a native WIN32 application so there are some concepts that don't translate well. For example, job control isn't supported and signal handling is limited. On the whole, though, I think it provides a reasonably comfortable shell experience.

Microsoft took this matter into their own hands and the result ended up being Powershell.

In the first iteration, they just ported Korn shell to windows but it wasn't that useful. So after a couple of iterations they ended up with Powershell.

Yeah, powershell came to mind though it's not quite the same thing (though sounds like it's closer than I thought!)

I still wonder if a modern, open-source, "this is designed to make bash people comfy" shell has a place

With Linux Subsystem For Windows and Docker working on windows, it feels like less of a problem than back in the bad old days.
The built-in Windows Command Shell is actually quite capable. However, syntax is rather different than *nix shells.
Putting aside the fact that there’s various bash implementations for Windows, Windows is not UNIX.

UNIX is file-based and Windows is object-based. Windows and UNIX users/engineers tend to have vastly different philosophies.

When Microsoft set out to create a new shell that rivaled bash, they came out of it with PowerShell.

I think they succeeded with that, PS performance issues aside.

why WSL and WSLv2 hasn't been mentioned by anyone.