← Back to context

Comment by sxldier

1 day ago

Sorry, which library feature?

I proposed adding an import builtin to bash on the mailing list. Sent patches too. Didn't go very well, to say the least.

Nevertheless, a version of the feature landed in bash 5.3.

  source -p "${HOME}/.local/lib/bash" file

You can use that to implement the library import function yourself.

  import() {
    local f
    for f in "$@"; do
      [[ -v loaded[$f] ]] && continue
      loaded[$f]=1
      source -p "${HOME}/.local/lib/bash" "${f}"
    done
  }

  import arguments terminal