What if instead of $PATH
there was a special directory on your system that
aggregated together a bunch of different binaries?
In SQL-land, to create a table-adjacent thing (our directory equivalent) that took results from several different tables you’d create a view with a union, ie.
``` SELECT name, path FROM bin
UNION
SELECT name, path
FROM sbin
WHERE name IN ('shutdown', 'reboot')
UNION
SELECT name, path
FROM usr_bin
```
In the naming of our example tables I’ve referenced when binaries commonly live on a modern *nix system.
Lets say we had this view-directory located at $HOME/.views/PATH
; and now we
can happily set export PATH=$HOME/.views/PATH
. I think that’s pretty cool,
we’ve added an obfuscating, unnecessary layer of abstraction to our system
(nice)!
What I like about this example if the flexibility shown in the second query – we can dynamically filter what’s in our path (you could achieve this sort of a setup using symlinks to individual files, but you’d constantly need to add more with new software).
Once I’ve thought about it some more (if I think about it some more), I might write a follow up piece exploring what a SQL-esque file system would look like.