Readit News logoReadit News
lucb1e · 3 years ago
> I know a lot of developers who will opt to do all of their scripting in python these days, even putting #!/bin/python3 at the head of a script so that it runs through the shell.

...which is exactly what you're meant to do.

This is not an example of how bad Bash it, it shows that you didn't understand what Bash is. It's expected to use various languages to write code on Linux, nobody wants you to do things in a language that wasn't made for the task.

Imagine you had to use Python on the shell and, any time you open a terminal, needed to import os and do something like print(os.path.glob("*")) instead of just opening a terminal and typing "ls" to get your directory listing. Different tools for different jobs.

Also the point they try to make about bash looking like a foreign language and having weird syntax. Yes, that's the thing: it's a very specific thing called a shell, not just any old programming language that you're meant to use for things that are not shell scripts. If Python feels more natural to you, that's probably what you should be using. Don't feel like you need to use Bash for bigger tasks than a few lines of code for no reason other than because you're on a system that has it.

lucb1e · 3 years ago
To be fair to OP, I would then go on to label these people as equally ignorant:

> A lot of people coming from the Unix-like world of macOS and Linux don't tend to know [PS]. Many people don't know it even exists at all. When I mention the Windows Terminal to people, they think I'm talking about the Windows Command Prompt, a crappy little program

I know that PS and the new terminal is not the same as cmd.exe, and that it has advantages like passing objects through pipes instead of stringly typing everything the way that sh-like shells work. But that's about the extent of it. (The powershell command names though, oh boy, even Java method names are better than that.)

> PowerShell also runs on Unix-like systems through PowerShell Core

I forgot about that. If anyone's interested in this, you may also enjoy learning that you can now run Windows Defender on Linux! And Internet Edgesplorer! The software we've all been waiting for, according to the Microsoft press release :D. These things amuse me to no end, but more seriously, getting to know PS better and trying out this object passing system does sound interesting.

Similar to how C# is secretly my favorite language, but it's just not well supported on Linux (mono and .netcore with monodevelop or the electron app called "VS Code" are just not the same as the Windows experience, e.g. Windows Forms and the real Visual Studio being huge omissions for me).

doorhammer · 3 years ago
> Similar to how C# is secretly my favorite language, but it's just not well supported on Linux

C# is not-so-secretly my favorite language (though Clojure is a close second) and I use it pretty often on macos/linux.

IDE wise have you given Rider a try? Imo it's a totally viable Visual Studio replacement for most C# dev, though not as nice for all workflows or related tech.

Worth looking at if you haven't. It's not free, though, so that can blow depending on your tolerance for licensing. I've personally had an all-products pass with jetbrains for awhile now, so doesn't bug me, but ymmv

I also get a lot of mileage out of C# notebooks in VSCode. Honestly, I use C# for a ton of my daily scripting because I built up so many utility scripts over the years in LINQPad on windows, and they were pretty trivial to port

doorhammer · 3 years ago
> The powershell command names though

Just wondering if you're talking about command name length or something else?

Asking because it comes up a lot and almost all the common commands have idiomatic short/terse versions (gci for Get-ChildItem, etc).

No shade, though. No reason you'd know if you don't have a reason to know it.

Would love to hear if I'm making the wrong assumption and it's something else you're talking about. I personally really love powershell, but also get why people love bash. I'm still pretty comfortable with bash because I work in *nix systems mostly, so it makes sense for me to know it, whereas the reverse (with ps) isn't really true for most devs

c7DJTLrn · 3 years ago
>A lot of people coming from the Unix-like world of macOS and Linux don't tend to know [PS]

We all have different experiences of life but I have never found this to be the case. Linux users are savvy and curious about things even outside their bubble.

The only people I can imagine this being true for is the true greybeards who have been daily driving Linux for 20 years.

emodendroket · 3 years ago
On the C# IDE front, Rider is excellent on all platforms (even on Windows I prefer it over VS), and a lot of production C# software is now running on Linux. It's not limited the way it used to be.

For PS, the other thing is I think people hear "object-oriented shell" and think every command has to be custom-built to interface with all the others and isn't pluggable like standard pipes, but that is untrue.

andylynch · 3 years ago
There was a time when Internet Explorer was possibly the best UNIX browser. We ran it on Solaris.
smoldesu · 3 years ago
Yeah. Reading the 3-pipe solution in bash versus 4-pipe solution in Powershell felt like it was verging on parody. Yes, these object-oriented features are nice - but they're something of a self-imposed problem on an OS that's designed like a database. Even the tools we use to parse JSON in bash aren't all that bad, if you can keep yourself grounded in the world of text processing.

I'm glad that the OP has a workflow that they like, but I'm not really convinced the grass is greener on the other side. I've used a lot of shells, Powershell doesn't really wow me that much anymore.

smcameron · 3 years ago
> even putting #!/bin/python3 at the head of a script so that it runs through the shell.

It's not the shell, it's the kernel that interprets the so-called shebang. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

Edit: oops, should have previewed, cryptonector beat me to it.

soraminazuki · 3 years ago
Yep, imagine how things would be like if the kernel didn't understand shebangs. exec() calls would fail for non-ELF executables and we'd be devising all sorts of ridiculous workarounds. We're lucky that didn't happen.
cryptonector · 3 years ago
> > even putting #!/bin/python3 at the head of a script so that it runs through the shell.

Uh, not, in that case the shell is not involved at all. The kernel implements shebang and will automatically start the interpreter, whatever it is, without having to go through the shell.

bombolo · 3 years ago
so, a typical noob. Even though he claims he shined in the operating systems course.
galleywest200 · 3 years ago
I thought we were supposed to be using `#!/usr/bin/env python3` and not `#!/bin/python3`?
Isognoviastoma · 3 years ago
There are two commands that do work in shebang: /bin/sh and /usr/bin/env. Everything else will break sooner or later: BSDs, Nix, Linux distros with separate /bin and /usr/bin and so on.
lucb1e · 3 years ago
Correct. What OP uses would run on none of the systems I work with as far as I know
silverwind · 3 years ago
Defintely, `#!/bin/python3` will not work inside venvs, I suppose.
eviks · 3 years ago
That "very specific thing" does not imply it should be so bad as to be foreign, you could have your much more ergonomic python in the shell as well without all the bash baggage
askvictor · 3 years ago
There _is_ Xonsh, which is Python based shell.
leoh · 3 years ago
Dude is productive using Windows. It works well for him. It could be an option for you or anyone else too. You've lost the plot here.
deathanatos · 3 years ago
> If the software is written well, it will be sufficiently cross-platform and modular enough

Yes … well …

We brought on via acquisition a bunch of Windows devs. It turns out we can't even clone the repository onto their laptops: some files in the repo have ":" in the filename, which is forbidden. There's a "aux.rs", also a verboten filename in Windows. And then there were some that differed only in case, which honestly I don't know how we manage that, as the non-Windows side is macOS, and yet roughly once per year someone introduces two files, same name, differing case into the repo.

> that "CRT" shader

Okay … that's not what CRTs looked like. Like, the curve seems way overdone compared to my memory, and IIRC the "lines" affect was really only visible on TV/camera. I have no memory of noticing it IRL, and I spent plenty of time at a command prompt.

(E.g., this random example — https://i.redd.it/1s3ny22b2va51.jpg — matches my memory pretty closely.)

(Also there were flat screen CRTs, but those were relatively late to the game and were rapidly obsoleted by actual flat screens.)

Edit: but also I want to play a round of Hack¹ with that shader.

¹i.e., quest for The Amulet of Yendor; you might know the newer incarnation, NetHack, but I didn't play that until flat screens, I think; the CRT time would have been on Hack.

majormajor · 3 years ago
Yeah, that looks like it's simulating the rolling lines that could show up in a video of a CRT, which is just an artifact of the camera and display both refreshing in similar fashions/at similar rates but usually not being locked to each other. A similar fixed lined/brightness gradient on a still photo is an artifact of a snapshot vs the persistence of vision effect that makes the screen look uniformly bright.

Some people were more sensitive to CRT flickers than others but it didn't look like that, even at 60hz (a low rate for a PC monitor). It was more a flashing-the-whole-screen-on-and-off-constantly effect; the effect of moving lines in videos move far slower than 60hz.

systemtest · 3 years ago
I had a bug last week. Some people on the team had certain files missing in ZIP-files generated by our back-end. So I downloaded the ZIP-files from the back-end and it worked fine for me. Asked them to sent me the ZIP-files directly, I could extract all files. I had no clue why it didn't work for them but I knew that they ran Windows. So I installed Windows 10 22H2 in a VM and as it turns out, having "->" in the filename causes Windows to ignore those files when extracting a ZIP-file.
justeleblanc · 3 years ago
> There's a "aux.rs", also a verboten filename in Windows.

That's not true.

> And then there were some that differed only in case, which honestly I don't know how we manage that, as the non-Windows side is macOS, and yet roughly once per year someone introduces two files, same name, differing case into the repo.

Sounds like a crappily maintained repo.

deathanatos · 3 years ago
> That's not true.

Well, just for you, I've searched the Slack history. IIRC, this was inside a WSL session in Windows, but it definitely originated on a Windows machine:

  $ git checkout rename-some-files
  error: invalid path 'foo-crate-1/src/aux.rs'
  error: invalid path 'foo-crate-2/src/aux.rs'
  error: invalid path 'foo-crate-3/src/aux.rs'
  <more filenames with other errors>

eviks · 3 years ago
One of those examples when religious backwards compatibility poisons the future for a much bigger user base
zamadatix · 3 years ago
You can enable case sensitivity per directory. That moves the problem to making sure any tooling they use doesn't have an issue with that though. E.g. Sublime is capable of opening something like C:\Example\file.txt instead of C:\example\file.txt but trying to open both at the same time doesn't work. Normally Sublime would put the folder path in front of the name but on Windows it assumes the folder path is not case sensitive and performs the "is this file already open" check with case insensitive logic.

The story with enabling long file paths is even sadder. Explorer doesn't support them, for example.

drewcoo · 3 years ago
> some files in the repo have ":" in the filename, which is forbidden. There's a "aux.rs", also a verboten filename in Windows

You're complaining 'bout 'doze, not devs. Come on, dude!

> (some business about CRTs but not whatever I expected with (absolutely correct-thinking) Line Feeds at the end of every line of text.)

Um . . .

Look, I understand that you didn't have enough experience to handle these outsiders, but that seems like the most understandable outsider group I can imagine. (And I don't have to imaging 'doze habits - I've seen a bunch up-close!)

matthewmorgan · 3 years ago
Could they keep the files in WSL and run their IDEs in Windows?
deathanatos · 3 years ago
IIRC, they were cloning in WSL, but AIUI at the time, WSL is still subject to the requirements Windows imposes on filenames.

(I'm not a WSL expert, so I could be wrong here.)

aprilnya · 3 years ago
not sure about other IDEs, but VSCode has very good WSL integration for doing this iirc
shortrounddev · 3 years ago
Disclaimer, I dont use the crt shader, I just thought its cool that you can do that
jmbwell · 3 years ago
Complaining that bash on macOS is old is valid, but it doesn’t seem relevant here. If you’re just going to use Powershell on Windows anyway, then surely bash doesn’t matter on either platform.

More relevant in my view is how well the workstation you use supports interacting with your build system. In many organizations, the actual build environment is only ever going to be Debian or alpine in a container, in which case, it doesn’t really matter which computer you have on your desk. If all your building happens remotely on a cloud instance, it hardly matters at all.

So by all means, use whatever computer you want. The great thing about the current era of computing is how little depends on the computer for getting work done. The author’s Chromebook story makes this point perfectly. Use what you have or what you like or what you can get, and get on with life, I say.

selectodude · 3 years ago
Mac OS switched to zsh a couple releases ago due to bash being GPL 3 so the shell isn’t old anymore and installing bash is as easy as brew install bash.
chrisweekly · 3 years ago
The default OS-provided shell is irrelevant; anyone who cares an iota about DX on their dev machine is going to set up their terminal and shell from scratch anyway.
pedrogpimenta · 3 years ago
Yeah he says because you have to update bash he prefers using WSL2. As if you don't have to install that???
shortrounddev · 3 years ago
I think you misread. I dont prefer WSL2, I rarely use it directly. I prefer powershell
m463 · 3 years ago
wrt relevance and relevance...

macos used to be relevant, but now (like the jackling house) all the unix underpinnings have been left to rot.

[1] https://en.wikipedia.org/wiki/Jackling_House

By the way, macos bash is technically in violation of the GPL, as it doesn't ship the source for rootless.h (no, not the x file by the same name)

pcthrowaway · 3 years ago
From everything I've heard about Windows turning into user-hostile bloatware over the last few years, nothing in this post seems like a good enough reason to use it. Perhaps it's Stockholm syndrom, but I honestly like my Unix-y tools (bash, jq, awk) at this point

Also, regarding this example

    {
        $Env:MYSQL_HOST = "MyHost.com";
        $Env:MYSQL_USER = "MyUser";
        java -jar myprogram.jar;
    }
You can do the same thing in Bash with perhaps slightly more verbosity

    (
        export MYSQL_HOST="MyHost.com";
        export MYSQL_USER="MyUser";
        sh -c 'echo "using $MYSQL_USER@$MYSQL_HOST"'
    )
    sh -c 'echo "using $MYSQL_USER@$MYSQL_HOST"'
outputs:

    using MyUser@MyHost.com
    using @

cyberbanjo · 3 years ago
At least one subtle difference, is a bare scope block like TFA has, will print out everything in it instead of the output you would expect, where as Bash behaves more like Invoke-Command -ScriptBlock {}.

Compare:

  PS /home/me> {
  >>     $Env:MYSQL_HOST = "MyHost.com";
  >>     $Env:MYSQL_USER = "MyUser";
  >>     java -jar myprogram.jar;
  >> }

    $Env:MYSQL_HOST = "MyHost.com";
    $Env:MYSQL_USER = "MyUser";
    java -jar myprogram.jar;


  PS /home/me> Invoke-Command -ScriptBlock {
  >>     $Env:MYSQL_HOST = "MyHost.com";
  >>     $Env:MYSQL_USER = "MyUser";
  >>     java -jar myprogram.jar;
  >> }
  Error: Unable to access jarfile myprogram.jar

emodendroket · 3 years ago
People were complaining that Windows was "user-hostile bloatware" as long as there's been a Windows to complain about.
cyberbanjo · 3 years ago
Sometimes a cliche is a cliche for a reason.

I certainly felt the hostility when I discovered the preloaded apps and ads in my Win11 install that aren't included in the much more expensive enterprise version.

msla · 3 years ago
https://news.ycombinator.com/item?id=35614190

> Microsoft plugging more ads into Windows 11 Start Menu

I mean, come on.

lionkor · 3 years ago
I dont really see the answer to the question in the article, maybe I missed it.

You can use PowerShell on Linux. You can use vcpkg on Linux (very well, even). You can learn C++ and you wont need the `_In_` and whatnot. If you use WSL2 for your development, are you even developing (fully) on Windows?

What you can't do is really own a copy of windows (any recent one), and have the freedom to decide what tools you will use. There is nothing protecting your system from locking you out of any setting, at any point, and requiring you to buy a different key, subscribing, giving them your data, or whatever else.

secstate · 3 years ago
This, a million times. I am not principled enough to live without closed source hardware and software. But I've experienced too many changes to tools I didn't ask for and didn't want to try to advocate that closed source is better than open source alternatives.
shortrounddev · 3 years ago
> If you use WSL2 for your development, are you even developing (fully) on Windows?

Maybe it wasn't clear in the post: I dont use wsl except as a backend for docker. I use powershell, not bash

> There is nothing protecting your system from locking you out of any setting, at any point, and requiring you to buy a different key, subscribing, giving them your data, or whatever else.

Thats not something I care about

secstate · 3 years ago
> Thats not something I care about

Well what's the point in having a debate about any of this if you've yet to experience closed source software taking something away from you?

AaronFriel · 3 years ago
I've followed a different path, but I've come to the same conclusion. Along my path, picking up languages like Haskell or Node early on meant using Linux. So since high school I've always had _a_ Linux machine available, but preferred to use Windows as the user interface.

Two thing I can say for any naysayers who use a Mac and do devops, backend development etc.:

1. Are you sure your environment that matches your deployment environment? Do you have confidence your server code runs the same on an Apple Silicon Mac as the (very likely) x86-64 and Linux environment your users use?

2. Have you ever noticed how shell scripts on Mac often... don't work the same on Linux? The way to fix that is of course use Homebrew, and, while brew has gotten leagues better, the quality pales in comparison to even Debian testing, Ubuntu main, or Arch and others.

As a devops engineer for many years, #2 was death by a thousand cuts. If I could, I'd have replaced every Mac user's userland with GNU coreutils from brew without their permission.

To square the circle of preferring Linux systems and Windows' UI, I've done just about every approach you can imagine to make that work, from syncing folders via rsync, to ssh or nfs mounted filesystems. I've used Virtualbox and VMWare and Hyper-V to locally run the Linux environment. There have been a few different X window managers and remote desktop tools, but none of them have been great.

WSL1 is where things really began to turn around - what an interesting project to make the NT kernel work as a Linux kernel. It didn't quite pan out, but that was OK.

WSL2 made major changes to how WSL worked, and now I can now run Kubernetes, Docker, 3d applications, machine learning (stable diffusion), have a real Linux shell and userland.

WSL2 is a true game changer for quality of Linux development on Windows. Being able to `docker run` Stable Diffusion or Llama or what-have-you is incredible.

I can imagine a PopOS - or another vendor-backed Linux OS - might persuade me eventually to shed Windows. In the meantime, I don't feel like I'm making any compromises.

minimaul · 3 years ago
> 1. Are you sure your environment that matches your deployment environment? Do you have confidence your server code runs the same on an Apple Silicon Mac as the (very likely) x86-64 and Linux environment your users use?

I’d argue that a lot of us are developing SaaS etc and the browser is our main touch point, so this isn’t necessarily as relevant.

shortrounddev · 3 years ago
I often run into the issue of forgetting to set node affinity in my deployments and my x86 backend not running on an ARM server we have for some reason (nothing we do requires ARM, so idk why we have those nodes)
hparadiz · 3 years ago
Your shell scripts on Linux don't even work the same way as the docker image based on ubuntu. Resolving those issues is just part of the job.

I recently had this issue where my version of SSH was too new compared to that the servers were running and I was getting issues about the cryptographic algorithm being mismatched.

bombolo · 3 years ago
> I recently had this issue where my version of SSH was too new compared to that the servers were running and I was getting issues about the cryptographic algorithm being mismatched.

I think that when your encryption algorithm gets removed, after having been deprecated, is really time to upgrade instead of commenting on ycombinator.

hesdeadjim · 3 years ago
After 8 years on macOS, I was forced into developing on Windows back in 2015 when I was making a VR game. WSL1 hit at exactly that time and once I suffered through setting up the environment on ConEmu (Windows Terminal nowadays is wonderful), I never looked back.
queil · 3 years ago
I have gone the other way. Used to be a hardcore C#/.NET Framework dev on Windows and I still occasionally use Windows 11. However, since the advent of containers and dotnet core I've been doing lots of devops work. WSL2 is annoyingly slow and has its quirks vs a normal Linux. Docker Desktop with WSL2 backend is slow too. PowerShell is cross-platform so one can use it on Linux just fine.