> It is not even theoretically possible to write a piece of software which will behave the same no matter how and where it is run.
Can you elaborate on that? I'm sure it's both true and false depending on your definition of "how and where it is run," but wondering what you had in mind specifically.
As for the "theoretically" part, it is enough to prove that at least one such a system exists that will yield another result than expected. There could be various reasons, from human/software errors to hardware errors like memory bit flips. Since we know these do exist, it is not even theoretically possible to write a piece of software which will behave the same no matter how and where it is run, although it is certainly possible to write it in such a way that it will behave the same in a vast majority of cases.
I'd say that containers are actually something that makes Unix shell a lot more valuable and predictable, and one reason that I'm working on https://www.oilshell.org/ .
A container is basically a "virtualenv" for shell, and it's honestly better than that because:
- it's more general (it isolates every language, not just Python), and
- not even bigger (e.g. an Alpine Linux container is not that much bigger than the Python install in every virtualenv!)
Traditionally you do indeed have the problem that copying a shell script from one machine to another basically guarantees you nothing about how it will work. These days we deploy containers, which solve the problem, and that's why shell is used so much in the cloud (e.g. anything with Github Actions has a boatload of shell)
I remember reading (sorry, can't remember the source) that it's been proven mathematically that there's no way to write code which will run the same on any Turing-equivalent processor. Obviously that's not saying much since Bash is pretty far abstracted from the CPU, it's more of a caveat that I've hardly ever seen a discussion about Bash which doesn't involve at least one "well, actually" comment about how the suggested code doesn't do what the autor purports on some incredibly niche platform or with some highly unusual configuration.
As another commenter mentioned, TrueNAS is my go-to for general storage and phone/PC/Mac backups; it's dead simple to setup and is extremely capable, not to mention it'll run on just about anything (barring the ZFS cache RAM requirements...). Personally, I keep a 'master' home folder on there that gets auto-mounted in whatever OS I boot into; this way I never have to go hunting around the NAS for files, for instance I just have a single "Documents" folder that effectively 'syncs' across my Mac, *nix, and Windows. I use CX File Explorer on Android to access the NAS, add a WireGuard VPN (which there's a great plugin for on TrueNAS) and you've got access to your files anywhere.
GDrive I was able to replace more or less with LibreOffice and Collabora, I rarely need to share documents outside PDF or print, which makes compatibility a non-issue for me (and even when I need to, saving as a .doc usually maintains layouts, fonts, etc.).
Nextcloud is pretty great. I use it for file storage/sharing, contacts, calendar, and notes. There is a way to run a GDocs clone on it as well but I have no need for an office suite.