ZSH: Qual é a diferença entre '.' e 'fonte'?

7

Eu costumava pensar que os itens incorporados . e source são equivalentes. Esta questão concorda comigo quando se trata de bash . No entanto, encontrei o seguinte usando zsh :

desktop➜  ~/pst  . env
/usr/bin/env:1: no such file or directory:  ^@^A^@^@^@X^Z@^@^@^@^@^@@^@^@^@^@^@^@^@\M-8q^@^@^@^@^@^@^@^@^@^@@^@8^@
/usr/bin/env:2: parse error near ')'
desktop➜  ~/pst  source env
desktop➜  ~/pst  file env
env: ASCII text

source fez o que eu esperava, mas o que o . está tentando fazer?

    
por Erik 15.03.2013 / 21:10

1 resposta

10

man zshall tem a resposta:

   source file [ arg ... ]
          Same as '.', except that the current directory is always searched and is always searched first, before directories in $path.

Exemplo:

desktop➜  ~/pst  source /bin/env
/bin/env:1: no such file or directory: ^@^A^@^@^@X^Z@^@^@^@^@^@@^@^@^@^@^@^@^@\M-8q^@^@^@^@^@^@^@^@^@^@@^@8^@
/bin/env:2: parse error near ')'
desktop➜  ~/pst  . env
/usr/bin/env:1: no such file or directory: ^@^A^@^@^@X^Z@^@^@^@^@^@@^@^@^@^@^@^@^@\M-8q^@^@^@^@^@^@^@^@^@^@@^@8^@
/usr/bin/env:2: parse error near ')'
    
por 15.03.2013 / 21:10

Tags