4 ms·
> Also, this does raise a few questions, though—if the writer has been using UNIX shells for that long, why are they using Windows at all? As I commented elsewh
by heavyset_go 2y ago
> Also, this does raise a few questions, though—if the writer has been using UNIX shells for that long, why are they using Windows at all? As I commented elsewhere, why shoehorn the whole set of UNIX core utilities and binary utilities onto Windows when the latter comes with its own shell, command-line utilities, and management tools?
I'm a Linux user and developer who writes software targeting Windows.
Tools like Git Bash and MSYS2 let me write one set of build scripts that work across Windows, macOS and Linux, because all of the tools exist on the three platforms.
I don't have a need to understand Windows on a more fundamental level, nor do I want to. I just want to meet my users where they are at, which is Windows/macOS/Linux.
- delta_p_delta_x 2y agoFair point. I've edited my comment to show my impression that the author uses Windows as a daily driver, rather than merely 'for work', which I think makes the cause for my confusion a little clearer.
- wilsonnb3 2y ago> Tools like Git Bash and MSYS2 let me write one set of build scripts that work across Windows, macOS and Linux, because all of the tools exist on the three platforms. Powershell is cross platform too these days, which makes this kind of a moot point.
- metadat 2y agoPowershell had potential, but it didn't pan out. It's annoying and very challenging to remember all the one-off flags. With bash, you only need to learn 10 or 20 short commands and a few flag variants, over a gently long period of time. Then you're all set for 97% of cases likely to be encountered.
- ants_everywhere 2y agoI just wrote a two line bash script to process some large csv files that Python/Pandas were taking far too long to process [0]. A lot of people (myself included) tend to underestimate the power of the heavily optimized GNU utilities and the ability to manipulate them with bash. [0] It was two lines for readability. It could have easily been a single line.
- partdavid 2y agoThis is the opposite of how I see it. There's really nothing universal about flags, especially short ones, in different random utilities (what's -n mean? -f? file, filter or force?). Whereas in Powershell since there actually is some standardization, your knowledge about what -WhatIf or -Verbose do is actually pretty leverageable. And more powerful with the ability set default parameters and so forth. And the discoverability and help in Powershell is also standardized. So I get why unfamiliarity would make it not worth it to switch from whatever shell you prefer, but I don't think I can see your point about flags.
- doubled112 2y agoPowershell on Windows is great because there’s a module for everything. I’d rather parse structured data. Powershell on Linux isn’t worth is because I end up having to parse everything as text anyway, completely negating any benefit I can come up with. It doesn’t feel as natural as the *nix tools to me.
- partdavid 2y agoFor what it's worth, I've had the opposite experience, maybe because I work in a different domain. Personally, I still think using Powershell functions and treating lines as string objects is an improvement over bash and its mini-languages, anyway; and most standard Unix commands have Powershell close equivalents. Some Powershell expressions might be abstruse but so is, say, awk; but when you've learned awk you only know awk; whereas the Powershell technique you used (calculated fields in select-object, for example) is permanently useful. I do spend a lot of my time with various random APIs so Powershell is pretty joyful compared to (say) curl/jq or yq-ish stuff. There was a real adjustment period, of course, getting used to a new shell; but it was the best thing about my experiment with Windows (discovering a new shell that I now use on my Unix-like systems, because I did not end up wanting to adopt Windows). So I'm curious what kinds of things you mean when you say you have to parse everything as text anyway. I suspect you've needed to a lot more of those kinds of tasks than I have.
- doubled112 2y agoPowershell's CSV, XML and JSON handing is my favourite Powershell feature. Completely agree with you that it beats a *nix shell and things like jq. If I was interacting with those all day I might be convinced to use it more. What I mean by parsing as text was more about actual commands. I wasn't expecting 1:1, but as an example, let's say I wanted to get a list of local users on a machine. On Windows I can use "Get-LocalUser". It returns an object with properties you can filter, output with a format, etc. Basic stuff that saves me doing any thinking. I like that. It's amazing how column titles add to the user friendliness. On Linux, Get-LocalUser doesn't exist, so I could run something like "getent passwd". It's only option is to return a screen of text. There's no structure yet, just lines and colons. Now I can (even though I shouldn't) grab fields with cut, or awk, and filter with grep, and maybe output something pretty at the end with column. What does the 5th column mean again? So on the Linux side, I've never been very motivated to use it, since I often have to fall back to old ways anyway.
- heavyset_go 2y agoBash + coreutils/busybox/etc are everywhere, I can take them for granted. I will have to jump through hoops to deploy Powershell outside of Windows. I also have no desire to use Powershell when I don't need to.
- dangus 2y agoBut they aren’t on windows, so they can’t be taken for granted there. You have to install git bash on windows. What’s the difference between installing git bash on windows and installing powershell on Mac/Linux? I would argue that there is none. And obviously it’s fine that you don’t want to use PowerShell, I don’t want to use it either. But personally I also dislike git bash on windows. It doesn’t feel like it belongs there, just like powershell doesn’t really belong on Linux/Mac. If I had to write a build script for all three platforms I would just write them for their native environments. I wouldn’t be all that willing to add another tool to be installed just to save myself the effort of simple build script.
- heavyset_go 2y agoI can run an MSYS2 installer on a Windows VM once and be done with it. I will have to roll my own containers, for example, if I want to use Powershell elsewhere, versus just using vanilla or vendor-provided images. For my use case, I don't see the need to bend my builds around Powershell just to use Powershell. This plays into my other point about not wanting to dig into Windows fundamentals when I don't need to. > If I had to write a build script for all three platforms I would just write them for their native environments. I wouldn’t be all that willing to add another tool to be installed just to save myself the effort of simple build script. This was my initial approach, but it became too much work to maintain separate build systems, especially when it came to making changes over time. One change becomes three, along with three new opportunities for things to break in three separate ways. For what I'm doing, moving to Unix-y toolchains simplified builds and made it much easier to reason about it.
- dangus 2y agoI totally get that your solution works for you and that is fantastic. I’m only questioning the pure logic behind it when you strip away opinion/preferences. You picking one OS that you’re okay with modifying but the other one you’re not. If we inversed that preference and said that I’m willing to modify my Linux containers but unwilling to install software on my Windows VM, the logic is the same. By the way, Microsoft publishes Linux images that already have PowerShell pre-installed. https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.4 https://learn.microsoft.com/en-us/powershell/scripting/insta... So, technically, if your build scripts were 100% PowerShell you could have it where both Windows VMs and Linux docker images could be unmodified. Since your build scripts sound overly complex, they could possibly benefit from a scripting language that’s got support for objects and object data pipelines, more advanced error handling, and more advanced object parsing than tools like sed and awk. Just playing “devil’s advocate” here, the logic checks out.
- deleted 2y ago[deleted]
- grepfru_it 2y agoGit bash has a terminal emulation problem. It’s fixable, but annoying problem that breaks tools. I recommend Cygwin or more recently WSL. YMMV