Set-proxy.sh

来自OSSmedia
Brucekomike讨论 | 贡献2025年1月6日 (一) 02:46的版本 (创建页面,内容为“#!/bin/bash # Create proxy.sh cat << 'EOF' | sudo tee /usr/local/bin/proxy.sh > /dev/null #!/bin/bash export ProIP="http://127.0.0.1:2080" export http_proxy="$ProIP" export https_proxy="$ProIP" # Execute the command passed as arguments "$@" EOF # Make proxy.sh executable sudo chmod +x /usr/local/bin/proxy.sh # Add bash completion for proxy.sh cat << 'EOF' | sudo tee /etc/bash_completion.d/proxy.sh > /dev/null _proxy_sh() { local cur prev opts COMPRE…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
  1. !/bin/bash
  1. Create proxy.sh

cat << 'EOF' | sudo tee /usr/local/bin/proxy.sh > /dev/null

  1. !/bin/bash

export ProIP="http://127.0.0.1:2080" export http_proxy="$ProIP" export https_proxy="$ProIP"

  1. Execute the command passed as arguments

"$@" EOF

  1. Make proxy.sh executable

sudo chmod +x /usr/local/bin/proxy.sh

  1. Add bash completion for proxy.sh

cat << 'EOF' | sudo tee /etc/bash_completion.d/proxy.sh > /dev/null _proxy_sh() {

   local cur prev opts
   COMPREPLY=()
   cur="${COMP_WORDS[COMP_CWORD]}"
   prev="${COMP_WORDS[COMP_CWORD-1]}"
   opts=$(compgen -c)  # List of all available commands
   COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
   return 0

} complete -F _proxy_sh proxy.sh EOF

  1. Reload bash completion

source /etc/bash_completion.d/proxy.sh

echo "proxy.sh setup complete with bash completion."