Re: Mulit-line aliases and PROMPT_COMMAND
Dan Douglas wrote: The 4.4 changes will make aliases even more interesting. --- Oh? Why is that? I.e. what's happening to aliases that will make them more "interesting"? BTW, are you using "interesting" in the same way as the saying "May you live in interesting times"?
Re: Mulit-line aliases and PROMPT_COMMAND
On Thu, Jun 2, 2016 at 7:18 PM, Grisha Levitwrote: > > On Thu, Jun 2, 2016 at 6:57 PM, Chet Ramey wrote: >> >> > Since bash 4.3 multi-line aliases interact very strangely >> >> And you're the first person to report them. I guess there aren't a lot of >> multi-line aliases out there. > > > I wonder if more crazy use cases will come out of the woodwork when RHEL and > SUSE finally get 4.3.. I think when they're used in an actual script rather than for interactive convenience multiline aliases are some of the more useful ones. The 4.4 changes will make aliases even more interesting.
Re: Mulit-line aliases and PROMPT_COMMAND
On Thu, Jun 2, 2016 at 6:57 PM, Chet Rameywrote: > > Since bash 4.3 multi-line aliases interact very strangely > > And you're the first person to report them. I guess there aren't a lot > of multi-line aliases out there. > I wonder if more crazy use cases will come out of the woodwork when RHEL and SUSE finally get 4.3.. > All of these will be fixed in bash-4.4. Thanks for taking a look.
Re: Mulit-line aliases and PROMPT_COMMAND
On 4/20/16 4:41 PM, Grisha Levit wrote: > Since bash 4.3 multi-line aliases interact very strangely, especially in > connection with PROMPT_COMMAND. And you're the first person to report them. I guess there aren't a lot of multi-line aliases out there. > 1. PROMPT_COMMAND is executed after every line in the alias, rather than just > before the prompt is drawn: > > 2. If PROMPT_COMMAND contains a command substitution (even one that is not > executed!) then only the first line of the alias is executed These two are the same problem. > 3. If an alias contains a command substitution (this is regardless of > PROMPT_COMMAND being set) something really non-sensical happens. This one actually took some time to track down. All of these will be fixed in bash-4.4. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Mulit-line aliases and PROMPT_COMMAND
Since bash 4.3 multi-line aliases interact very strangely, especially in connection with PROMPT_COMMAND. 1. PROMPT_COMMAND is executed after every line in the alias, rather than just before the prompt is drawn: alias a=$'echo 1\necho2' PROMPT_COMMAND='echo $HOSTNAME' $ a 1 home 2 home $ 2. If PROMPT_COMMAND contains a command substitution (even one that is not executed!) then only the first line of the alias is executed alias a=$'echo 1\necho2' PROMPT_COMMAND='echo ${HOSTNAME-$(hostname)}' $ a 1 home $ 3. If an alias contains a command substitution (this is regardless of PROMPT_COMMAND being set) something really non-sensical happens. alias a=$'echo 1 $(id)\necho 2' $ a 1 2 id $ For the end user, replacing any multi-line aliases with ';' delimited ones should probably work just fine. I can't think of any use-cases where the behavior of one style would be different from another so maybe multi-line aliases should be disallowed.