aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/update.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-09-23 05:13:20 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-09-23 05:13:20 +0300
commit73bee881675aba670d79056203435c8f169fe159 (patch)
tree7aef003ae11e460d7763fc5205d2cc7a9fad15a1 /update.sh
parentfix output indentation (diff)
downloadconfig-links-73bee881675aba670d79056203435c8f169fe159.tar.gz
config-links-73bee881675aba670d79056203435c8f169fe159.zip
refactoring
Diffstat (limited to '')
-rw-r--r--update.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/update.sh b/update.sh
index fe21f78..40225dc 100644
--- a/update.sh
+++ b/update.sh
@@ -167,6 +167,8 @@ delete_obsolete_entries() {
done
}
+var_name_regex='%\([_[:alpha:]][_[:alnum:]]*\)%'
+
discover_new_entries() {
local src_var_dir
while IFS= read -d '' -r src_var_dir; do
@@ -174,7 +176,7 @@ discover_new_entries() {
local var_name
var_name="$( basename "$src_var_dir" )"
- var_name="$( expr "$var_name" : '%\([_[:alpha:]][_[:alnum:]]*\)%' )"
+ var_name="$( expr "$var_name" : "$var_name_regex" )"
dump " variable name: $var_name"
if [ -z "${!var_name+x}" ]; then
@@ -206,7 +208,7 @@ discover_new_entries() {
database[$entry]=1
done < <( find "$src_var_dir" -type f -print0 )
- done < <( find "$script_dir" -regextype posix-extended -mindepth 1 -maxdepth 1 -type d -regex '.*/%[_[:alpha:]][_[:alnum:]]*%$' -print0 )
+ done < <( find "$script_dir" -regextype posix-basic -mindepth 1 -maxdepth 1 -type d -regex ".*/$var_name_regex\$" -print0 )
}
main() {