Posts

Showing posts from February 12, 2019

How to add subdir bin of first dir in GOPATH to PATH

Image
1 echo $GOPATH will print: /mnt/star/program/go/package:/mnt/star/git_repository/workspace/go_workplace There are 2 dir, I want to append the first dir's sub dir bin/ to $PATH . If I write $PATH=$PATH:$GOPATH/bin , then actually it append 2 dir to $PATH : /mnt/star/program/go/package This only contains dirs, it should be /mnt/star/program/go/package/bin . /mnt/star/git_repository/workspace/go_workplace/bin This actually shouldn't be added to $PATH . BTW, there are cases that $GOPATH only contains one dir, in that case simply append $GOPATH/bin will work. I am looking for a solution that fit for both cases. So, how to write this in bash config file? linux bash shell share | im