3 ms·
Unfortunately, if you want your scripts to be portable to other POSIX systems you might have to use the short options, as the long ones are not standardized. Yo
by saagarjha 2y ago
Unfortunately, if you want your scripts to be portable to other POSIX systems you might have to use the short options, as the long ones are not standardized. You have to decide the tradeoff for yourself.
- pcwalton 2y agoWhat POSIX systems in actual use (not historical Unixes) don't have the long options? macOS' BSD utilities I guess?
- saagarjha 2y agoYes or like BusyBox
- schneems 2y agoYou can also brew install tools like gnused which have the same arguments. Not a viable option for all situations but if you just need to execute it on Linux and your local machine for dev you can use those.
- yjftsjthsd-h 2y ago> What POSIX systems in actual use (not historical Unixes) don't have the long options? All of them except for GNU, AFAICT? (That is, only GNU seems to have long options.) Checking manpages for rm(1) as a simple reference, I can't see long options in any of the 3 major BSDs or illumos, and checking Alpine Linux seems to show busybox also only doing short options (sorry, can't find an online doc for this, though it's easy to check in docker if you don't have a machine running Alpine handy). OpenWRT also uses busybox and has the same (lack of) options. https://man.netbsd.org/rm.1 https://man.netbsd.org/rm.1 https://man.openbsd.org/rm.1 https://man.openbsd.org/rm.1 https://man.freebsd.org/cgi/man.cgi?query=rm&apropos=0&sektion=1&manpath=FreeBSD+14.2-RELEASE+and+Ports&arch=default&format=html https://man.freebsd.org/cgi/man.cgi?query=rm&apropos=0&sekti... https://illumos.org/man/1/rm https://illumos.org/man/1/rm
- SoftTalker 2y agoMore than this, the gnu utilities often have options that don't exist at all on other platforms, in either long or short form.
- deleted 2y ago[deleted]
- mplanchard 2y agoUsing nix has really spoiled me on this. Everyone gets the same versions of all the CLI utilities in the dev environment, whether on mac or linux, and those are the same versions that run in CI and any prod systems. It’s really nice being able to use whichever newer bash features or gawk extensions you like, without having to deal with trying to ensuring the mac engineers have brew-installed all the right stuff to match a standard linux env.
- paulddraper 2y agoEveryone has to use nix :) But yes, that is nice.
- mplanchard 2y agoThat is the caveat. I initially set it up such that it wasn’t required: you could choose to use it if you wanted to, and otherwise here is a list of specific versions things you must install, etc. Everyone ultimately chose to use nix, and now it’s required. Makes for a pretty easy setup though for new devs: install nix, then run `nix develop`, then `make setup`, and you’re off to the races.
- delusional 2y agonix didn't solve your issue here. nix didn't do anything. You're just describing the benefit of a reproducible development environment. You could do the same thing with brew, pacman, apt, or by just compiling every package from source from some huge mirror. It's exactly the same thing people initially loved about docker or vagrant.
- mplanchard 2y agoSure, but it works on Mac and Linux and doesn’t require virtualization. I think brew might qualify, but it can’t define which environment variables should be available in the developer shell or which hooks to run upon entry. I don’t think any of the other options you specified can manage the same thing.