From c7377e3eb74a73874f9d2253083b3ae952156ac8 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 26 Oct 2017 02:57:32 -0400 Subject: Make use of Bash's '-n' operator for tests As an example, do this: [[ -n $revision ]] instead of this: ! [[ -z $revision ]] Makes the code easier to read. --- tools/blobs-discover/blobs-discover | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/blobs-discover') diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover index 3ced106c..5d197723 100755 --- a/tools/blobs-discover/blobs-discover +++ b/tools/blobs-discover/blobs-discover @@ -75,7 +75,7 @@ verify() { requirements "sort" - if ! [[ -z "$project_blobs_path" ]] + if [[ -n "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else @@ -136,7 +136,7 @@ execute() { local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) local project_blobs_directory_path - if ! [[ -z "$project_blobs_path" ]] + if [[ -n "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else @@ -159,7 +159,7 @@ execute() { printf '%s\n' "$files" | while read file do - if ! [[ -z "$project_blobs_ignore_path" ]] + if [[ -n "$project_blobs_ignore_path" ]] then match=$( grep "$file" "$project_blobs_ignore_path" || true) if [[ ! -z "$match" ]] @@ -169,7 +169,7 @@ execute() { fi match=$( "$deblob_check_path" -l -i "" "$file" || true ) - if ! [[ -z "$match" ]] + if [[ -n "$match" ]] then printf '%s\n' "$match" >> "$project_blobs_discover_path" fi @@ -187,7 +187,7 @@ execute_check() { local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) local project_blobs_discover_path - if ! [[ -z "$project_blobs_path" ]] + if [[ -n "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else -- cgit v1.2.3-70-g09d2