News for hackers. Stuff that matters.
Re:Sherver: Bash lightweight web server by junon on Wednesday December 22, 2021 @08:16AM (#29648889)
Yep, I'm sure. It's not a guarantee (nor is it specified, to my knowledge) that the inlining happens. You also used a subshell there, which might make a difference.
Re:Sherver: Bash lightweight web server by BeefWellington on Wednesday December 22, 2021 @08:32AM (#29649043)
The original poster is using a subshell. Your example uses echo, which is both a built-in AND an external program.

They are not comparable. I've never seen a shell inline cat, probably because it would make no sense given there are POSIX builtins to do exactly what cat does.

Re:Sherver: Bash lightweight web server by junon on Wednesday December 22, 2021 @09:14AM (#29649535)
It of course makes sense since `cat` is widely used for the purpose of the original code, just not in a subshell. It's used often to output blocks of text to stdout/err for multiline output, namely --help text.

strace doesn't lie here, and I've seen it substitute cat in trivial cases quite often.

Re:Sherver: Bash lightweight web server by BeefWellington on Thursday December 23, 2021 @12:42AM (#29659015)
Indeed strace doesn't lie but you have yet to provide an example of a system where what you're saying about cat is true. You've shown a number of examples which do not actually back up the claim you are making, and have not responded to other posters pointing out the flaws in the examples you did provide.

I'm genuinely curious to see an implementation but I suspect you've misunderstood something in the past and your statement was incorrect.