this post was submitted on 21 May 2024
146 points (100.0% liked)

Programming

423 readers
5 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

New favorite tool ๐Ÿ˜

you are viewing a single comment's thread
view the rest of the comments
[โ€“] jack@monero.town 4 points 6 months ago* (last edited 6 months ago) (1 children)

There is no sh shell. /bin/sh is just a symlink to bash or dash or zsh etc.

But yes, the question is valid why it compiles specifically to bash and not something posix-compliant

[โ€“] emptiestplace@lemmy.ml 13 points 6 months ago (1 children)
[โ€“] jack@monero.town 2 points 6 months ago* (last edited 6 months ago) (1 children)

Yes, there was the bourne sh on Unix but I don't see how that's relevant here. We're talking about operating systems in use. Please explain the downvotes

[โ€“] BatmanAoD@programming.dev 10 points 6 months ago (1 children)

It's relevant because there are still platforms that don't have actual Bash (e.g. containers using Busybox).

sh is not just a symlink: when invoked using the symlink, the target binary must run in POSIX compliant mode. So it's effectively a sub-dialect.

Amber compiles to a language, not to a binary. So "why doesn't it compile to sh" is a perfectly reasonable question, and refers to the POSIX shell dialect, not to the /bin/sh symlink itself.

[โ€“] jack@monero.town 6 points 6 months ago