December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.
The only difference between them is a semicolon at the end of the last command in second alias
alias test_alias1 'echo `echo one \!*`;echo done' alias test_alias2 'echo `echo one \!*`;echo done;'
Redirection to files works, too (kind of: "done" does not get redirected, because of where the redirection gets inserted into the alias, but I don't care about redirecting "done"):
> test_alias1 1 2 3 one 1 2 3 done > test_alias2 1 2 3 one 1 2 3 done
However, trying to pipe breaks for the alias that ends with a semicolon, returning an error:
> test_alias1 1 2 3 > tempout done > test_alias2 1 2 3 > tempout done
Anyone with a good understanding of why this breaks only if there is a semicolon at the end?
> test_alias1 1 2 3 | tee tempout one 1 2 3 done > test_alias2 1 2 3 | tee tempout Invalid null command.
( test_alias2 1 2 3 ) | tee tempout