I want to run a bash script that invokes a dataset in a parallel directory as a variable. I must use a relative path to this file. So far I have been able to retrieve the full path of the script using the SO answer here. How can I modify this path to change it to the path of target file in the parallel directory? Alternatively, is there a superior way to obtain this resource based only on the location of the script?
script pseudo path = "project/scripts/myscript.sh"
data pseduo path = "project/data/mydata.csv"
contents of myscript.sh
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
echo "$parent_path"
How can I alter $parent_path
to get the path to my data?