我正在使用 GIT bash。 我有这个文件“proxy_functions.txt”:
function proxy(){
echo -n "username:"
read -e username
echo -n "password:"
read -es password
export http_proxy="http://$username:$password@proxy:8080/"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
echo -e "\nProxy environment variable set."
}
function proxyoff(){
unset HTTP_PROXY
unset http_proxy
unset HTTPS_PROXY
unset https_proxy
unset FTP_PROXY
unset ftp_proxy
unset RSYNC_PROXY
unset rsync_proxy
echo -e "\nProxy environment variable removed."
}
加载到我的 GIT bash 中,以便当我在 shell 中写入“代理”,然后我的用户并传递代理以使 GIT bash 准备好将内容推送到我在 GIT 中心的在线存储库时...
它曾经工作得很好,但现在我想我搞砸了,因为当我在 GIT bash 中写“代理”时,它说
bash: proxy: command not found
如何从写入命令的 txt 文件“proxy_functions.txt”中将命令重新插入到 GIT bash 中?
最佳答案
您需要在 bash.bashrc
文件中获取 proxy_functions.txt
脚本。因此,例如,如果 proxy_functions.txt
位于 C:\Users\Arcones\proxy_functions.txt
,那么您将需要在 bash.bashrc 中添加一行
文件说:
source C:\Users\Arcones\proxy_functions.txt
关于linux - 从 txt 向 Git bash 添加函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36696204/