I've been using emulate sh -c ". $HOME/myscript.sh" and it's working so far.

However, if I'm at ~ and try to do emulate sh -c ". myscript.sh", I get .: no such file or directory: myscript.sh.. Why?

1 Answer 1


The . builtin looks for the script passed argument in the command search path ($PATH) if it doesn't contain a /. This is true both in POSIX shells and in native zsh, so unsurprisingly it's true in zsh's sh emulation mode as well.

The source builtin in bash and zsh is identical to . except that no PATH lookup happens, a script name not containing a / is looked for in the current directory.

emulate sh -c 'source myscript.sh'


emulate sh -c '. ./myscript.sh'
  • Ah, yes, that makes much more sense.
    – terdon
    Jan 3, 2014 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.