S
S
Sergey Burduzha2019-04-09 08:39:49
bash
Sergey Burduzha, 2019-04-09 08:39:49

Why don't changes from .bashrc take effect?

Good afternoon.
I work in windows.
I am using git-bash terminal.
There is an alias in the .bashrc file. alias cp="rsync -avz -P"
I used this alias in Ubuntu, but I don't need it in Windows, so I commented it out.
I have two aliases

#alias gitlog='git log --graph --pretty=oneline --abbrev-commit --all --decorate'
164 alias gitlog='git log --pretty=format:"%h %ad | %s%d [%an] " --graph --date=short'

As you can see, the first one is commented out, but when I enter gitlog into the terminal, that is what is displayed.
Why?
I save and close the .bashrc file.
I write in the terminal source ~/.bashrc
Then I enter the cp command again and an error pops up that the rsync command is not known.
That is, the changes from .bashrc did not take effect?
How to fix it?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Bogachev, 2019-04-09
@serii81

The command source ~/.bashrcloads .bashrc again, everything is correct here, but there is a little subtlety: if alias is already set, then removing it from .bashrc will not change anything. You can draw an analogy (not entirely correct, but still) with a demon - it was launched once at the start and it exists and will exist until you finish it with your own hands. Here one of two things - either completely reload bash (which is not always desirable), or use the command unalias.

A
andgera, 2019-04-09
@andgera

I save and close the .bashrc file.
I write in the terminal source ~ / .bashrc
That is, the changes from .bashrc did not take effect?
judging by what is written, you don’t have the rsync command, you need
to do $ whereis rsync
and if the output looks like this:
then everything is fine and rsync installed then
$ unalias cp || alias cp='/usr/bin/rsync -avz -P'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question