[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange 'delayed' aliases
From: |
Jonathan |
Subject: |
Re: strange 'delayed' aliases |
Date: |
Wed, 23 Dec 2009 07:06:44 -0800 (PST) |
User-agent: |
G2/1.0 |
On Dec 23, 7:34 am, Chet Ramey <chet.ra...@case.edu> wrote:
> I would think so, since you've inserted a command continuation (the escaped
> newline) into the command via the alias. It's the same as if you had typed
>
> *$* echo \
> *>* Hello, World!
>
> The only unexpected part is the re-issuing of $PS1 as opposed to $PS2.
> I'll have to take a look at that.
It certainly seems to be related to command continuations. Here are a
few more symptoms:
1) Text on the same line as the alias is run directly as a separate
command. Bash doesn't see it as part of the original command:
$ x Hello
$ World!
Hello: command not found
2) Adding text to the second line of the alias causes the alias to run
immediately but the added text is ignored:
$ alias x='echo \
> Hello'
$ x
$
3) Adding text before the continuation in the alias causes the command
history to report the second line as a separate command:
$ alias x='echo Hello, \
> '
$ x
$ World!
Hello, World!
$ history 2
481 x; World!
482 history 2
Hope this helps.
- Jonathan