From 6c0afd8deba7a1b411e10d34e40835388cf39ba3 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 23 May 2018 23:01:10 +0300 Subject: bash best practices --- update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/update.sh b/update.sh index 782b641..77a48a1 100755 --- a/update.sh +++ b/update.sh @@ -224,7 +224,10 @@ update_database_path() { fi db_path="$( traverse_path --file -- "$1" )" - mkdir -p -- "$( dirname -- "$db_path" )" + + local db_dir + db_dir="$( dirname -- "$db_path" )" + mkdir -p -- "$db_dir" } ensure_database_exists() { @@ -375,7 +378,9 @@ discover_new_entries() { is_dry_run && continue - mkdir -p -- "$( dirname -- "$symlink_path" )" + local symlink_dir + symlink_dir="$( dirname -- "$symlink_path" )" + mkdir -p -- "$symlink_dir" ln -f -s --no-target-directory -- "$shared_path" "$symlink_path" database[$entry]=1 -- cgit v1.2.3