: [arguments] Do nothing beyond expanding arguments and performing redirections.How can a pipeline or a compound command be used with :? Braces don't seem to solve the problem:$ : { echo hello | cat; }bash: syntax error near unexpected token `}'$ : { if test 1; then echo hello; fi; }bash: syntax error near unexpected token `then'Double quotes will prevent some expansions, which : allows.The same problem happens when using echo instead of :.$ echo { echo hello | cat; }bash: syntax error near unexpected token `}'$ echo { if test 1; then echo hello; fi; }bash: syntax error near unexpected token `then'Basically I want to run a command up to expansions and redirections with :, and check the result with echo. The quote doesn't mention pipe and control flow keywords won't work, so I only expect that alias expansion will not happen. Thanks.
How can a pipeline or compound command be used with `:` and `echo`?
bash
: { echo hello | cat; }The shell parses this command line. First it tries to find the end of the first command. That end is the pipe.So the first command is: { echo hellowhich does nothing. Especially it pipes nothing into cat. With: { echo hello | cat;being gone there is only the } left which is not a valid command.