0

Following advice from a course, I added the following line to my .bashrc:

export PATH=/home/dodgycoder/kafka_2.12-2.3.1/bin:$PATH

Now, when I open a terminal window I get this directory shown twice:

$ echo $PATH
/home/dodgycoder/kafka_2.12-2.3.1/bin:/home/dodgycoder/kafka_2.12-2.3.1/bin:/usr/local/bin:...

Why is this? What's the correct way to add a directory to your PATH?

I'm using Fedora with the Gnome desktop. I confirm I only have the above line just once in my .bashrc and it's not defined anywhere else.

  • 1
    Try adding another line: export PARENTS="[$PPID/$(</proc/$PPID/comm)],$PARENTS", then it'll end up having the names of every process which invoked bash along the way. – user1686 Nov 22 '19 at 14:20
0

.bashrc is not the best place to set $PATH or any other environment variable, since it may be invoked more than once.

Environment variables had better be set in ~/.profile.

See the following posts:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.