0

we have couple of softlinks to scripts a directory in our current directory. Let's take we have two softlinks , script1 and script2. We are referencing script2 from within a script1 like below.

. script2

It was running fine until we changed our infrastructure. Now, if we trigger the softlink script1 it's not able to find the softlink script2 in it and throws error. Though it works if we change the softlink reference in script1 like below.

. ./script2

Any obvious reason for that.

1 Answer 1

1

As the bash manpage explains, source (which . is a shorthand for), searches the file in $PATH if it does not contain a /, thus

. script1

is just wrong and your issue has nothing to do with symbolic links, but it's more an issue of versions of bash (this behavior changed at some point in time, IIRC). At least zsh and dash (which is a rather compliant POSIX-shell) do this the same.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .