Skip to content

Commit

Permalink
Find the config file in the script directory
Browse files Browse the repository at this point in the history
If there is not a config file in the working directory or if one is not
specified, look in the directory where the script was run
  • Loading branch information
raackley committed Jan 24, 2017
1 parent 34299dc commit 5900e27
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions zfs-replicate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ elif [ -f "config.sh" ]; then
## source default config
printf "Sourcing configuration from config.sh\n"
. "config.sh"
elif [ -f "$(dirname ${0})/config.sh" ]; then
## source script path config
printf "Sourcing configuration from $(dirname ${0})/config.sh\n"
. "$(dirname ${0})/config.sh"
else
## display error
printf "ERROR: Cannot continue without a valid configuration file!\n"
Expand Down

0 comments on commit 5900e27

Please sign in to comment.