INNER CODE UNIT · Shell

command

lework/kainstall · kainstall-centos.sh:233

function command::exec() {
  # 执行命令

  local host=${1:-}
  shift
  local command="$*"
  
  if [[ "${SUDO_TAG:-}" == "1" ]]; then
    sudo_options="sudo -H -n -u ${SUDO_USER}"
  
    if [[ "${SUDO_PASSWORD:-}" != "" ]]; then
       sudo_options="${sudo_options// -n/} -p \"\" -S <<< \"${SUDO_PASSWORD}\""
    fi
    command="$sudo_options bash -c $(utils::quote "$command")"
  fi
  
  command="$(utils::quote "$command")"
  

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…