bash - Adding a directory of files to PATH -
i'm trying add set of subdirectory's path in simple way possible.
currently structure is:
main_project/ subproject/bin/ subproject2/bin/ subproject spaces/bin/
i'm using simple bash-fu in .bash_profile:
path="$path:$(echo /projects/main_project/*/bin | tr ' ' ':')"
the problem path spaces comes out as:
subproject:with:spaces/bin/
in $path
you should using printf
instead:
path="$path$(printf ":%s" /projects/main_project/*/bin)"
Comments
Post a Comment