Comment

Comment by ceph_

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.

Your function does that so +1. Though I'd use

    [[ $PATH =~ "(^|:)$newelement($|:)" ]] 
over grep -q but it functions the same.
parent ceph_ 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton