Variables as commands in Bash scripts

Simply don’t put whole commands in variables. You’ll get into a lot of trouble trying to recover quoted arguments. Also: Avoid using all-capitals variable names in scripts. It is an easy way to shoot yourself in the foot. Don’t use backquotes. Use $(…) instead; it nests better. #! /bin/bash if [ $# -ne 2 ] … Read more

Add a bash script to path

Try this: Save the script as apt-proxy (without the .sh extension) in some directory, like ~/bin. Add ~/bin to your PATH, typing export PATH=$PATH:~/bin If you need it permanently, add that last line in your ~/.bashrc. If you’re using zsh, then add it to ~/.zshrc instead. Then you can just run apt-proxy with your arguments … Read more