Hacker News new | past | comments | ask | show | jobs | submit login

What sort of capabilities does sh-lang provide that Python cannot? Does sh-lang have some sort of privileged access to the OS not available to Python?



posix sh mandates certain constructs work. For example:

   x=foo; x=${x%o}; echo $x # prints 'fo'
Supporting that is non-trivial in python. There's no quotes around the strings, '%' is kinda weird there, etc.

Of course, in python you can just say:

   x="foo"; x=x[0:2]
... but those are not compatible with each other. colon does different things in posix sh than python, and it would be quite complicated to reconcile it.

I'll also point out the parent poster, when they wrote "sh-lang", meant "the superset of posix-sh that zsh/bash users expect", because at this point quite a few bash features are expected to work in most sh-like shells.

Naturally, both xonsh and sh (and all other shells pretty much) are turing complete and can execute programs, which makes them all equally capable.

Having equivalent capabilities does not mean things are compatible though. I recommend reading up on what a POSIX shell is, and then reading fish and xonsh's arguments why they're not POSIX compliant (spread through various locations)


He means it's not POSIX-compliant. You can't replace /bin/sh with it and expect stuff to work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: