Linux设置环境变量

可以在~/.bashrc里增加相应条目,但更好的方法是在~/.local/bin/env中增加。例如:

~/.local/bin/env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
# add binaries to PATH if they aren't added yet
# affix colons on either side of $PATH to simplify matching
case ":${PATH}:" in
*:"$HOME/.local/bin":*)
;;
*)
# Prepending path in case a system-installed binary needs to be overridden
export PATH="$HOME/.local/bin:$PATH"
;;
esac

export http_proxy=http://192.168.1.2:7890
export https_proxy=http://192.168.1.2:7890