I'm a bit new to bash and its workings but I am wondering is there anyway in bash to access a directory that may change in its address due to where the user installs it in bash. (This happens all the time, so there must be)
For example:
I have a program that has the directory of ../program-directory/..
But then the user downloads the program files in /extra-directory/
creating a situation where we have /extradirectory/program-directory
Then I have a bash script that runs in ../program-directory/script-directory/script/example.bash
I would then like to grep -rnw 'sample text' /program-directory
from the example.bash
script
Is there any simple way in one line I can grep in program-directory
without the hassle of where the user installed this program
FYI, I have looked at Can a Bash script tell which directory it is stored in? but I need to grep in ../program-directory
from a script called in a sub-directory of ../program-directory