INNER CODE UNIT · Shell

utils

lework/kainstall · kainstall-centos.sh:172

function utils::quote() {
  # 转义引号

  # shellcheck disable=SC2046 
  if [ $(echo "$*" | tr -d "\n" | wc -c) -eq 0 ]; then
    echo "''"
  elif [ $(echo "$*" | tr -d "[a-z][A-Z][0-9]:,.=~_/\n-" | wc -c) -gt 0 ]; then
    printf "%s" "$*" | sed -e "1h;2,\$H;\$!d;g" -e "s/'/\'\"\'\"\'/g" | sed -e "1h;2,\$H;\$!d;g" -e "s/^/'/g" -e "s/$/'/g"
  else
    echo "$*"
  fi
}


function utils::download_file() {
  # 下载文件
  
  local url="$1"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…