3 ms·
you could easily imagine some Python-esque shell language (xonsh?) and have that be: print(os.path.exists("ssh://user@rsync.net:fileThatExists")) A boolean, a
by rtpg 4y ago
you could easily imagine some Python-esque shell language (xonsh?) and have that be:
print(os.path.exists("ssh://user@rsync.net:fileThatExists"))
A boolean, a still (relatively) terse line of code. And when you end up wanting to do something even a bit more complicated it'll be a smooth gradient of difficulty.
As with every discussion around shells, though, the amazing terseness of scripts is great, but every form of programmatic behavior beyond "do this then that" and "do string interpolation here" is a massive pain in the butt. The biggest advantage is that stuff like pipes are a very good DSL.
- johnchristopher 4y ago> you could easily imagine some Python-esque shell language (xonsh?) and have that be: > print(os.path.exists("ssh://user@rsync.net:fileThatExists")) That's just invoking the whole jungle when all you want is a banana.
- rtpg 4y agoWhat do you think happens when you invoke a shell? It's not some magical primitive, it also does string parsing and all the other stuff that a scripting language requires. SSH also has to parse the line! I did say Python-esque (I do get that Python in particular has a lot of stuff in its prelude). Really if you want to be super pedantic then the most "banana"-y isn't a line in your shell but some C library calls on both sides of the system.
- johnchristopher 4y ago> What do you think happens when you invoke a shell? It doesn't crash because I forgot to import os ?
- j-bos 4y agoAm I understanding correctly that the concern is syntax based? If so, why not build a wrapper over the existing shell language? If not, can you please clarify?
- rtpg 4y agoWell my first thing is I would want a defacto norm adopted in the same way that bash is basically available everywhere. And of course we would want it to be something that doesn't have the busted dependency story of Python. And I would like for third party programs to have a rich interface be provided through this new shell. For example, you can interact with docker in Python with a lib, but it would be amazing if the docker binary just exposed an RPC interface and API for script languages so you wouldn't have to parse out things from output or otherwise try to figure things out when writing shell scripts. This is, of course, the PowerShell thing, but PS's aesthetics displease me and many other people. Computers are, of course, turing complete. You can do whatevery you want, really. But for example I end up using zsh instead of xonsh because I want to use what other people write as well.
- j-bos 4y agoUnderstandable, the challenge is beating the xkcd one more universal standard.
- znpy 4y agobtw, assuming you're deploying on kubernetes: you're omitting the 500 lines of yaml needed to deploy that, the tens of megabyte for the python base image (of which you'll waste more than 99.99%) and the tens of megabytes in bandwidth to the docker registry and to download it on the kubernetes worker... And the image wight should be accounted at least four times: worker node + 3 in the docker registry (ha and stuff). it's incredibly inefficient if you just freaking want to know if a file exists.