Reputation: 1023
I would like to know if my following implementation is correct or wrong.
I have a variable called $MY_HUGE_PATH_VARIABLE
.
I need to enhance it by adding a few directories and all directories within those directories.
I set it up like this:
export MY_HUGE_PATH_VARIABLE=$PATH_1/version1/*\:\
$PATH_2/version4/*\:\
$PATH_n/versionn/*\
Is this correct. Does that *
work when exporting paths? Are there any other issues with this piece of script. I am working on a Redhat Linux machine and my script in bash shell.
My aim is to include all the jar files within these folders for my Java compilation. My intention is to understand this stuff. the shell has not really thrown any errors to me as of yet and the script is part of a bigger set-up which I have not yet tested.
Upvotes: 0
Views: 691
Reputation: 2681
EDIT:- you dont need to specify * here, in linux it works like this:-
export MY_HUGE_PATH_VARIABLE=$MY_HUGE_PATH_VARIABLE$( find $PATH_1/version1/ $PATH_2/version4/ $PATH_n/versionn/ -type d -printf ":%p" )
Upvotes: 3
Reputation: 2776
Please try the following:
export MY_HUGE_PATH_VARIABLE=$(find $PATH_1/version1 $PATH_2/version4 $PATH_n/versionn -type d | tr '\n' ':')
Upvotes: 0