Re: [Help-bash] confused by command substitution...
From:
Alfred M. Szmidt
Subject:
Re: [Help-bash] confused by command substitution...
Date:
Mon, 11 Feb 2019 11:45:58 -0500
> I'm not understanding the difference here, or why the last example
> works. Anyone got a good explanation?
>
> $ if "$(echo x)"; then echo foo; fi
> bash: x: command not found
> $ if "$(echo x > /dev/null)"; then echo foo; fi
> bash: : command not found
> $ if $(echo x); then echo foo; fi
> bash: x: command not found
> $ if $(echo x > /dev/null); then echo foo; fi
> foo
They're all 100% wrong.
Clearly they aren't. They are also syntatically valid according to
POSIX grammar rules from what I can see.
And please calm down, there is no need for such a overly agressive
tone. If you find yourself using such a tone, better is to not reply
to an message, or wait a day and rewrite it.