[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sourcing a script from a pipe is not reliable
From: |
Robert Elz |
Subject: |
Re: Sourcing a script from a pipe is not reliable |
Date: |
Fri, 11 Jan 2019 05:36:17 +0700 |
Date: Thu, 10 Jan 2019 13:52:59 -0800
From: Jeremy <asfbugzilla@nuru.net>
Message-ID:
<CAP_kx+7PSMZCmAevKBnmvB1pgoB_TALbNSk0x9Rj=0U1k9tE2w@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
- Sourcing a script from a pipe is not reliable, (continued)
- Sourcing a script from a pipe is not reliable, Jeremy, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Eduardo Bustamante, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Jeremy, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Chet Ramey, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Jeremy, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Chet Ramey, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Jeremy, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Martijn Dekker, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Jeremy, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Chet Ramey, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable,
Robert Elz <=
- Re: Sourcing a script from a pipe is not reliable, Robert Elz, 2019/01/10
- Re: Sourcing a script from a pipe is not reliable, Greg Wooledge, 2019/01/10
Re: Sourcing a script from a pipe is not reliable, don fong, 2019/01/10
Re: Sourcing a script from a pipe is not reliable, Jeremy, 2019/01/10