bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the difference between a newline and a semi-colon?


From: Chet Ramey
Subject: Re: What is the difference between a newline and a semi-colon?
Date: Fri, 30 May 2014 13:00:30 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 5/30/14, 11:01 AM, Bruce Korb wrote:
>     $ . xx ; cat xx ; proj ; pwd ; pwd -P
>     alias proj="cd ~/'google drive'/web"
>     bash: proj: command not found
>     /home/sciadmin/tmp
>     /home/sciadmin/tmp
>     $ . xx
>     $ cat xx ; proj ; pwd ; pwd -P
>     alias proj="cd ~/'google drive'/web"
>     /home/sciadmin/google drive/web
>     /home/sciadmin/foo bar/web
> 
> Clearly, there is a behavioral difference.  Is this a bug or feature?

Eric's summary is comprehensive.  Here's a shorter version.

1.  The shell always reads at least one complete line before parsing and
    executing it.

2.  The shell parses the line into commands before executing any of them.

3.  Aliases are expanded when the line is read, not when it is executed.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]