- !/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 Zsh completion for proxy.sh
mkdir -p ~/.zsh/completion
cat << 'EOF' > ~/.zsh/completion/_proxy.sh
- compdef proxy.sh
_proxy_sh() {
local -a args args=( '*:: :_normal' ) _arguments -s -S $args
}
_proxy_sh "$@" EOF
- Ensure the completion directory is sourced in .zshrc
if ! grep -q "fpath+=~/.zsh/completion" ~/.zshrc; then
echo "fpath+=(~/.zsh/completion)" >> ~/.zshrc echo "autoload -U compinit && compinit" >> ~/.zshrc
fi
echo "proxy.sh setup complete with Zsh completion."