Live data from Hacker News

The Bun Shell

bun.sh

131–140 of 239 posts

Re: The Bun Shell

#131
post #75
post #29

doesn't work with Windows: https://github.com/oven-sh/bun/issues/43

This is super confusing considering the text in the article.

There's an unstable windows build of bun. I imagine they're working out the final few kinks but want to make sure this new lib is ready to go now

Re: The Bun Shell

#132

I’m increasingly fed up with all shell scripts. Sure shell scripts are great when they’re small. Except then they become not small. But they don’t get rewritten. Piping strings of instructed text between programs is an error prone nightmare. I want full debugger support, strong typing, cross platform support, and libraries not programs. Python isn’t my favorite language. But I’ll take a debugable Python script over b…

That's part of the beauty of bun though. You can write it in typescript instead and run it directly with bun. And now with this you can weave in a call to a binary very easily if you need

Re: The Bun Shell

#134

Earlier quoted context omitted.

The most common usecase is probably “I have `rm` in the scripts section of package.json, and it doesn’t work on windows.”

> Bun provides a limited, experimental native build for Windows. > # WARNING: No stability is guaranteed on the experimental Windows builds Now your scripts simply will randomly break on Windows and you won't even know why!

I don't think that's permanent. Eventually they'll have a stable release on windows

Re: The Bun Shell

#136

"JavaScript is the world's most popular scripting language." Perhaps, based on usage. But shell must be the world's most ubiquitous scripting language. Not every computer has a Javascript engine but most have a shell. Many, many computers have no browser, let alone a GUI. Some small form factor computers might have embedded Javascript engine but that's a minority. No browser on the router.

Not true - shell does not run on Windows, iPhones etc. Even macOS has issues with those who assume Linux is the only Unix, Apple's bash is very old and does not run many scripts. Unfortunately Javascript does get installed everywhere,

Uh, MacOS has zsh (which has far more features than most other POSIX shells), and even old bash has POSIX compatibility.

Your TV/IoT device likely has busybox, as does your router.

You install git on windows, it's got a (POSIX) shell.

The number of places that lack a shell is tiny.

Node/deno/bun are rare, and browsers whilst being more common, still require the device to have some kind of GUI.

Re: The Bun Shell

#137

It feels like the people behind bun are trying to differentiate from node so much that they sometimes don't stop to ask why. I'm sure there's a use-case somewhere, but if I'm using js I will just use a regex instead of reaching for grep. If I want the shell I'll use the shell.

I'd personally rather write my long shell scripts in js for my js-based project. And I wouldn't bring in grep to run a regex either but I'd use it to run a myriad of other tools that aren't implemented in js.

Re: The Bun Shell

#138

Earlier quoted context omitted.

Not true - shell does not run on Windows, iPhones etc. Even macOS has issues with those who assume Linux is the only Unix, Apple's bash is very old and does not run many scripts. Unfortunately Javascript does get installed everywhere,

Uh, MacOS has zsh (which has far more features than most other POSIX shells), and even old bash has POSIX compatibility. Your TV/IoT device likely has busybox, as does your router. You install git on windows, it's got a (POSIX) shell. The number of places that lack a shell is tiny. Node/deno/bun are rare, and browsers whilst being more common, still require the device to have some kind of GUI.

> You install git on windows, it's got a (POSIX) shell.

I don't think it's in the path by default so if some program like npm calls exec("rm") it's still going to fail I think.

Re: The Bun Shell

#139

I really have a "scientists asked if they could not if they should" feeling about this one. I've seen and tried lots of solutions like that in different languages, but believe now it's a wrong level of abstraction. If you want to provide some crossplatform way to execute ls, providing an "ls()" function is much cleaner. Otherwise you start accumulating issues like: which flags are supported, does it support streaming…

I wouldn't ls in a random js script either. Use readdir exactly like shown in the article. But to hack something quickly in package.json? Yes, absolutely. I'm not turning all my 1 liners into standalone scripts to potentially maybe avoid using an arg that never got implemented. And now it's cross platform too so I only have to test it on 1 system.

Re: The Bun Shell

#140
post #27

Their info about "rm -rf" not working in Windows is slightly misleading. In PowerShell, you can accomplish this by running: rm -r -fo my-folder-name

The reason I used rimraf was it was a way to make JS delete all files in the directory. Why would I need to think to shell out to "rm -rf dir" and be responsible for argument escaping, error handling, different shells, etc. If that's what the library does, ok, but it can do it in any way the library devs decided was best. I offloaded that decision to them (putting more trust in them to do it right than in myself).
Post reply on HN