Set-ac.sh

来自OSSmedia
  1. !/bin/bash
  1. Create proxy.sh

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

  1. !/bin/bash

taskset -c 0-1 "$@" EOF

  1. Make proxy.sh executable

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

  1. Add bash completion for proxy.sh

cat << 'EOF' | sudo tee /etc/bash_completion.d/ac.sh > /dev/null _ac_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 _ac_sh ac.sh EOF

  1. Reload bash completion

source /etc/bash_completion.d/ac.sh

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