ZSH: Qual a diferença entre `.` e` source`?

10

Eu costumava pensar que os embutidos .e sourcesão equivalentes. Esta pergunta concorda comigo quando se trata 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

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

Erik
fonte

Respostas:

13

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 `)'
Erik
fonte