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 arguments from the importing to the imported Bash script.

I currently emulate the behavior I seek for with the following function:

function _import {
  local -r file="$1"
  set -- "${@:2}"
  source "$file" "$@"
}

For details please see my question and the answers on Unix & Linux
Exchange [1].

[1]
http://unix.stackexchange.com/questions/151889/why-does-bashs-source-command-behave-differently-when-called-from-a-function

Cheers
Tim

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to