0

Because I'm not familiar with the way to add permanent path, I export the wrong dir accidently, which is /home/adolph/anaconda3/condabin. (It should be /home/adolph/anaconda3/bin)

adolph@adolph-System-Product-Name:~$ echo $PATH
/home/adolph/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/adolph/anaconda3/bin:/home/adolph/anaconda3/bin

I tried to remove the wrong directory in the method introduced by most of the post. reference1 reference2

adolph@adolph-System-Product-Name:~$  PATH=$(echo "$PATH" | sed -e 's/:\/home\/adolph\/anaconda3\/condabin$//')

However, it still exist. How to solve it in effective way?

adolph@adolph-System-Product-Name:~$ echo $PATH
/home/adolph/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/adolph/anaconda3/bin:/home/adolph/anaconda3/bin
  • How exactly did you "add permanent path"? I see little value in modifying it programatically - just correct what you did and start a new shell. (BTW the reason your sed fails is that :\/home\/adolph\/anaconda3\/condabin$ only matches a trailing path component.) – steeldriver Mar 30 '22 at 21:20

1 Answers1

1

You could define your desired PATH for your current session like this: export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/adolph/anaconda3/bin If you want that change to be permanent, you could add that line to your ~/.bashrc.