Arcones Arcones - 9 months ago 31
Bash Question

Add function to Git bash from txt

I am working with GIT bash.
And I have this file "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,,localaddress,"
echo -e "\nProxy environment variable set."

function proxyoff(){
unset http_proxy
unset https_proxy
unset ftp_proxy
unset rsync_proxy
echo -e "\nProxy environment variable removed."

loaded in my GIT bash in order to, when i write "proxy" in the shell and then my user and pass of the proxy to have the GIT bash ready to push things to my online repo in GIT hub...

It used to work fine but now I think i mess it up beacuse when I write "proxy" in GIT bash it says

bash: proxy: command not found

How can I reinsert the command in GIT bash from the txt file "proxy_functions.txt" where it is written?


You will need to source the proxy_functions.txt script in your bash.bashrc file. So, if for instance proxy_functions.txt is located at C:\Users\Arcones\proxy_functions.txt, then you will need a line in your bash.bashrc file that says:

source C:\Users\Arcones\proxy_functions.txt