0

How do I ignore a proxy if not available? and would like to make a bash script to create the files but the script skipped some parts and did not include the variables.

$ cat > /etc/apt/detect-http-proxy <<- _EOF_
... all the contents of the file  until this line ...
print_msg() {
  # \x0d clears the line so [Working] is hidden
  [ "$show_proxy_messages" = 1 ] && printf '\x0d%s\n' "$1" >&2
}
for proxy in "${try_proxies[@]}"; do
  # if the host machine / proxy is reachable...
  if nc -z ${proxy/:/ }; then
      proxy=http://$proxy
      print_msg "Proxy that will be used: $proxy"
      echo "$proxy"
      exit
  fi
_EOF_

So the contents of that file when I do cat is:

$ cat /etc/apt/detect-http-proxy
print_msg() {
  # \x0d clears the line so [Working] is hidden
  [ "" = 1 ] && printf '\x0d%s\n' "" >&2
}
for proxy in ""; do
  # if the host machine / proxy is reachable...
  if nc -z ; then
      proxy=http://
      print_msg "Proxy that will be used: "
      echo ""
      exit
  fi

How do we fix this? And also a comment in 2016 mentioned of Acquire::http::Proxy-Auto-Detect. How do we use this?

1 Answers1

0

lol sorry found the answer ... just type \ before the variable \$proxy

How about Acquire::http::Proxy-Auto-Detect?