Question on argument passing
I have a script that is run by issuing source script.sh.
The directory structure looks like this:
project_root/
|- script.sh
|- plugins
|- manifest
script.sh has a function inside that looks like this:
# call additional modification scripts
if [ ! -e "plugins/manifest" ]; then
printf("Error: Could not find manifest file.")
return
fi
Because this function uses the relative path of the plugins directory, if I were in working on a file in the plugins directory I could not issue a command like this: source ../script.sh.
Is it possible for the calling command source ../script.sh to pass the relative directory (..) to script.sh so that script.sh could find the plugins directory?
Posted Feb 21, 2016, 8:38 PM UTC
32