Skip to content

Errors under /bin/sh #7

@l8nite

Description

@l8nite

Looks like the init is doing some bash-specific stuff. I ran into this trying to do some ndenv stuff in a Dockerfile RUN statement (which executes as sh -c)

root@53f25125c2a2:/# sh -c 'eval "$(ndenv init -)"'
sh: 2: eval: source: not found
sh: 5: typeset: not found

Compare this to rbenv:

root@53f25125c2a2:/# sh -c 'eval "$(rbenv init -)"'
root@53f25125c2a2:/#

Here is the rbenv init output:

root@53f25125c2a2:/# sh -c 'rbenv init -'
export PATH="/opt/rbenv/shims:${PATH}"
export RBENV_SHELL=sh
rbenv rehash 2>/dev/null
rbenv() {
  local command
  command="$1"
  if [ "$#" -gt 0 ]; then
    shift
  fi

  case "$command" in
  rehash|shell)
    eval "`rbenv "sh-$command" "$@"`";;
  *)
    command rbenv "$command" "$@";;
  esac
}

And the ndenv init output:

root@53f25125c2a2:/# sh -c 'ndenv init -'
export PATH="/opt/ndenv/shims:${PATH}"
source "/opt/ndenv/libexec/../completions/ndenv.bash"
ndenv rehash 2>/dev/null
ndenv() {
  typeset command
  command="$1"
  if [ "$#" -gt 0 ]; then
    shift
  fi

  case "$command" in
  rehash|shell)
    eval "`ndenv "sh-$command" "$@"`";;
  *)
    command ndenv "$command" "$@";;
  esac
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions