Date: Fri, 19 Mar 2021 09:12:34 +0100 From: Alex fxmbsw7 Ratchev <fxmb...@gmail.com> Message-ID: <caalkergcnx4jdkk1+tdkvdtgdwltdb+ztlzqp35f2wwx_yq...@mail.gmail.com>
| eval $'alias n=bla\nn() { type $FUNCNAME ; }\nn' | bla is a function | bla () | { | type $FUNCNAME | } | | it was supposed to be n() .. nothing to do with the \n that woukd have worked just fine. the first command in the eval'd string aluan n=blah t tekks the shell that whever it sees n on the command name position itshoukd be replaved by blah Next command starts n ... That's the command word position, so because of the alias, you get blah instead. aliases are a very low level textual substitution mechanism. After that I suspect everything is obvious. I suggest that if you want to learn shell programming (and learning is obviousky required) you should start with the simple things first. Definitely leave aliases and associative arrays for some later year. And remember the purpose of the shell (any shell) is to run other commands. If that is not what you're wanting to do, you should be using some other programming language. There are plenty. Find one suited to your needs and learn/use that instead. kre