diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2018-07-10 13:08:38 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2018-07-10 13:20:52 +0300 |
commit | 15b90575dc6c7ad6f45a52cbb6a5be913418729d (patch) | |
tree | 4bf0b05ae63fc97649ea10a6227f37411ce9a8fa /update.sh | |
parent | bash best practices (diff) | |
download | config-links-15b90575dc6c7ad6f45a52cbb6a5be913418729d.tar.gz config-links-15b90575dc6c7ad6f45a52cbb6a5be913418729d.zip |
support a dumb variable for root path /
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -161,6 +161,11 @@ resolve_variable() { return 0 fi + if [ "$var_name" = "$root_var_name" ]; then + echo '' + return 0 + fi + if [ -z "${!var_name+x}" ]; then dump "variable is not set: $var_name" >&2 return 1 @@ -178,6 +183,7 @@ cache_variable() { done } +readonly root_var_name='CONFIG_LINKS_ROOT' readonly var_name_regex='%\([_[:alpha:]][_[:alnum:]]*\)%' extract_variable_name() { @@ -278,7 +284,7 @@ delete_obsolete_dirs() { return 1 fi - ( cd -- "$base_dir" && rmdir -p --ignore-fail-on-non-empty -- "$subpath" ) + ( cd -- "$base_dir/" && rmdir -p --ignore-fail-on-non-empty -- "$subpath" ) } delete_obsolete_entries() { |