Re: Feature request: Add "import" built-in.

2014-08-26 Thread Chet Ramey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/24/14, 7:36 AM, Tim Friske wrote: > Hi, > > as I see it the "source" built-in is perfect for embedding a sourced > Bash script into the sourcing one while preserving as much of the > environment, specifically the positional and special parameters

Re: Feature request: Add "import" built-in.

2014-08-25 Thread Greg Wooledge
On Mon, Aug 25, 2014 at 11:10:31PM +0800, lolilolicon wrote: > On Mon, Aug 25, 2014 at 8:04 PM, Greg Wooledge wrote: > > On Sun, Aug 24, 2014 at 01:36:38PM +0200, Tim Friske wrote: > >> I currently emulate the behavior I seek for with the following function: > >> > >> function _import { > >> loc

Re: Feature request: Add "import" built-in.

2014-08-25 Thread lolilolicon
On Mon, Aug 25, 2014 at 8:04 PM, Greg Wooledge wrote: > On Sun, Aug 24, 2014 at 01:36:38PM +0200, Tim Friske wrote: >> I currently emulate the behavior I seek for with the following function: >> >> function _import { >> local -r file="$1" >> set -- "${@:2}" >> source "$file" "$@" >> } > > Ho

Re: Feature request: Add "import" built-in.

2014-08-25 Thread Greg Wooledge
On Sun, Aug 24, 2014 at 01:36:38PM +0200, Tim Friske wrote: > I currently emulate the behavior I seek for with the following function: > > function _import { > local -r file="$1" > set -- "${@:2}" > source "$file" "$@" > } How is this different from source, exactly? You're passing all of t

Re: Feature request: Add "import" built-in.

2014-08-24 Thread Andreas Schwab
Tim Friske writes: > set -- "${@:2}" Aka shift. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Feature request: Add "import" built-in.

2014-08-24 Thread Tim Friske
Hi, as I see it the "source" built-in is perfect for embedding a sourced Bash script into the sourcing one while preserving as much of the environment, specifically the positional and special parameters, as possible. What I am missing is the "import" built-in that passes only the explicitly given