By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Alias expansion

Given the following alias:
openssl enc -base64
the following command line works
echo test|base 64
while the following doesn't
echo test|base64|base64 -d
resulting in
TCC: Unknown command "base64"
LocalAliases = Yes

And how are you reloading your aliases in your secondary shells?

Your command:

echo test|base64|base64 -d

does this:

1) TCC looks for the first base64, discovers it's an alias, and expands it.
2) It then creates a child TCC process and connects a pipe between the current TCC process and the child TCC process, that is passed the command line "openssl base64|base64 -d".
3) The child process then tries to find an alias "base64" and create another child process to connect another pipe.

If you haven't loaded your local aliases in those child pipe processes, they are not going to be able to expand "base64".

This should work if you use DOS pipes, or you have your TCSTART reload aliases in the child pipe processes.
1) Thanks.
2) The question for me is however, why wouldn't TCC expand all the aliases on the command line, given the fact that a "LocalAliases" setting exists, and that "base64" is a valid alias in the scope of the current shell?
TCC only expands aliases for the current command. It would be a very bad thing for it to try to expand aliases in subsequent compound commands -- those commands might well be adding / changing / deleting aliases. Or you might be passing commands to another shell (CMD, PowerShell, bash, etc.) that doesn't expect or want TCC to be preprocessing its command line.

Similar threads