The semantics of `.' are rather peculiar to say the least. Here is a simple script -- it just displays its positional parameters:
Put this in a file, `foo'. Here is another simple script -- it calls the first script. Put this in another file, `wrapper':
Observe what happens when you run this from the command line:
So `$0' is inherited from the calling script, and the positional parameters are as passed to the command. Observe what happens when you call the wrapper script with arguments:
So the sourced script has access to the calling scripts positional parameters, unless you override them in the `.' command.
This can cause no end of trouble if you are not expecting it, so you must either be careful to omit all parameters to any `.' command, or else don't reference the parameters inside the sourced script. If you are reexecuting your script with a shell that understands functions, the best use for the `.' command is to load libraries of functions which can subsequently be used in the calling script.
Most importantly, don't forget that, if you call the