Date:        Thu, 10 Jan 2019 13:52:59 -0800
    From:        Jeremy <asfbugzi...@nuru.net>
    Message-ID:  
<CAP_kx+7PSMZCmAevKBnmvB1pgoB_TALbNSk0x9Rj=0u1k9t...@mail.gmail.com>

  | We are trying to determine if the current shell supports passing positional
  | arguments to a script sourced by dot (.), and we are trying to do it in a
  | way that will work under pretty much any shell.

The only real way to do that is to actually write such a script, and test it.
If you cannot write the script, you're basically out of luck, tricks with
/dev/stdin are not the way forward.

But the real question is why?

If you're prepared for a "no" answer, then why not simply assume the answer
is always going to be "no" for all shells ?

If you really need "." scripts with args, you could use

rundot()
{
        __F="$1"
        shift
        . "$__F"
}

or something similar (probably with some error checking) to
simulate processing a "." script with args.   The extra cost of
calling that function

        rundot script arg1 arg2 ...

rather than just

        . script arg1 arg2

isn't worth worrying about, the cost of the search for script,
and opening it, etc, dwarfs everything else that would be
happening, and that is the same both ways.

kre


Reply via email to