Re:How to add a directory to your PATH
by ceph_ on Thursday February 27, 2025 @11:21AM
(#43195785)
I'm surprised both the blog post and all the other comments don't mention how it should have logic to check if the item exists in the path before adding it.
Otherwise you get duplicates added everytime you source your config.
Re:How to add a directory to your PATH
by rascul on Thursday February 27, 2025 @05:53PM
(#43199471)
Another option is to set the full $PATH value explicitly instead of doing an add thing for each directory. This avoids duplicates and the extra logic, but maybe isn't as convenient.
Your function does that so +1. Though I'd use
over grep -q but it functions the same.