Ray Salemi
Ray Salemi

Reputation: 5903

Path to bash source?

We're seeing a situation where this:

% . setup.sh

sources a different file (in a different directory) than

% . ./setup.sh

Is there some sort of path that affects the '.' command?

Upvotes: 0

Views: 38

Answers (1)

chepner
chepner

Reputation: 531075

Arguments to source that don't contain a / are subject to PATH lookup.

If bash is not in POSIX mode, and it cannot find the requested file on your PATH, then the current directory is searched as well (which can lead to the impression that path lookup is not performed in the first place).

Upvotes: 1

Related Questions