I'm working on an install script (written in bash) for a library. The install script lives in a subdirectory of the project's base directory. I'd like users to be able to run the install script from anywhere under the base directory, so I'm trying to make the script cd
to the base directory before executing other commands.
I'm looking at something like
while [[ $PWD == *"ProjectName"* ] && [ $PWD -ne *"ProjectName" ]]; do cd .. ;done
I'm open to cleaner solutions, but at the very least I'd like to understand why the above does not work. No doubt I have brackets in the wrong spots, but I'm not sure where to put them.