News for hackers. Stuff that matters.
Re:Windows gets a new terminal by runako on Monday May 06, 2019 @11:57PM (#19846412)
That's pretty neat! Will have to try that the next time I'm using Windows.

Based on the peer comments I was replying to, a lot of Windows developers aren't even aware of this ability (hence my comment).

Thanks for clarifying!

Re:Windows gets a new terminal by int_19h on Tuesday May 07, 2019 @04:11AM (#19847455)
In fact, you don't even need to be in bash - WSL also installs a Win32 binary bash.exe, that redirects to Bash inside your default Linux install (there can be several). Which means that you can do this in cmd:

   bash -c "cat somefile.txt | sort | uniq > output.txt"
Since bash handles pipes and redirection in this case, it preserves Unix semantics exactly. And since WSL can see all your filesystems (they're mounted under /mnt/c, /mnt/d etc), and bash.exe maps current working directory, this works in any directory.

This is much more tedious when you have to specify paths, because they have to be mapped explicitly, much like cygpath in Cygwin:

   bash -c "cat `wslpath -u 'C:\Temp\somefile.txt'` | sort | uniq > output.txt"