From 4e3505463eadffd9f1994f8ecaba9b1d693ec7bf Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Wed, 25 Oct 2017 23:11:15 -0400 Subject: Modify fd copying in printf calls for readability --- libs/common | 12 ++++++------ libs/project | 18 +++++++++--------- libs/tool | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'libs') diff --git a/libs/common b/libs/common index fd001a5d..750886db 100755 --- a/libs/common +++ b/libs/common @@ -157,7 +157,7 @@ file_checksum_check() { if ! [ -f "$checksum_path" ] then - printf '%s\n' 'Could not verify file checksum!' >&2 + printf 1>&2 '%s\n' 'Could not verify file checksum!' return 1 fi @@ -187,7 +187,7 @@ file_signature_check() { if ! [ -f "$signature_path" ] then - printf '%s\n' 'Could not verify file signature!' >&2 + printf 1>&2 '%s\n' 'Could not verify file signature!' return 1 fi @@ -383,7 +383,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done @@ -400,7 +400,7 @@ requirements_root() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done @@ -429,8 +429,8 @@ execute_root() { local sudo=$( which sudo 2> /dev/null || true ) local arguments - printf '%s' 'Running command as root: ' >&2 - printf '%b\n' "$*" >&2 + printf 1>&2 '%s' 'Running command as root: ' + printf 1>&2 '%b\n' "$*" if ! [ -z "$sudo" ] then diff --git a/libs/project b/libs/project index 37a5973c..524e6222 100755 --- a/libs/project +++ b/libs/project @@ -81,12 +81,12 @@ project_action() { project_action_check "$action" "$project" "$@" - printf '%s\n' "Project $project $action (with ${arguments:-no argument})" >&2 + printf 1>&2 '%s\n' "Project $project $action (with ${arguments:-no argument})" if "$action" "$@"; then - printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) completed" >&2 + printf 1>&2 '\n%s\n' "Project $project $action (with ${arguments:-no argument}) completed" else - printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) failed" >&2 + printf 1>&2 '\n%s\n' "Project $project $action (with ${arguments:-no argument}) failed" return 1 fi ) @@ -171,7 +171,7 @@ project_action_arguments_verify_recursive() { test="$(printf '%s\n' "$action_helper_arguments" | grep -e "^$argument\$" || true)" if [[ -z "$test" ]]; then - printf '%s\n' "Invalid argument $argument for project $project action $action" >&2 + printf 1>&2 '%s\n' "Invalid argument $argument for project $project action $action" return 1 fi fi @@ -325,7 +325,7 @@ project_sources_directory_filled_error() { if ! [ -z "$sources_path" ] then - printf '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) already exists" >&2 + printf 1>&2 '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) already exists" return 1 else return 0 @@ -341,7 +341,7 @@ project_sources_directory_missing_empty_error() { if [ -z "$sources_path" ] then - printf '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 + printf 1>&2 '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) missing or empty" return 1 else return 0 @@ -422,7 +422,7 @@ project_sources_archive_missing_error() { local archive=$( project_sources_archive "$project" "$@" ) if [ -z "$archive" ] || ! [ -f "$archive" ] then - printf '%s\n' "Missing sources archive for $project (with ${arguments:-no argument})" >&2 + printf 1>&2 '%s\n' "Missing sources archive for $project (with ${arguments:-no argument})" return 1 else return 0 @@ -804,7 +804,7 @@ project_build_directory_missing_empty_error() { if ! directory_filled_check "$build_path" then - printf '%s\n' "Build directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 + printf 1>&2 '%s\n' "Build directory for project $project (with ${arguments:-no argument}) missing or empty" return 1 else return 0 @@ -1010,7 +1010,7 @@ project_install_directory_missing_empty_error() { if ! directory_filled_check "$install_path" then - printf '%s\n' "Install directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 + printf 1>&2 '%s\n' "Install directory for project $project (with ${arguments:-no argument}) missing or empty" return 1 else return 0 diff --git a/libs/tool b/libs/tool index 8ed70e18..41bf0cc1 100755 --- a/libs/tool +++ b/libs/tool @@ -79,7 +79,7 @@ tool_action() { if ! tool_check "$tool" then - printf '%s\n' "Tool $tool check failed" >&2 + printf 1>&2 '%s\n' "Tool $tool check failed" return 1 fi @@ -97,7 +97,7 @@ tool_action() { return 0 fi - printf '%s\n' "Tool $tool $action (with ${arguments:-no argument})" >&2 + printf 1>&2 '%s\n' "Tool $tool $action (with ${arguments:-no argument})" ( set -e @@ -106,10 +106,10 @@ tool_action() { if [ $? -ne 0 ] then - printf '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) failed" >&2 + printf 1>&2 '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) failed" return 1 else - printf '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) completed" >&2 + printf 1>&2 '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) completed" fi ) } @@ -125,7 +125,7 @@ tool_action_check() { if ! tool_check "$tool" then - printf '%s\n' "Tool $tool check failed" >&2 + printf 1>&2 '%s\n' "Tool $tool check failed" return 1 fi @@ -162,7 +162,7 @@ tool_action_helper() { if ! tool_check "$tool" then - printf '%s\n' "Tool $tool check failed" >&2 + printf 1>&2 '%s\n' "Tool $tool check failed" return 1 fi -- cgit v1.2.3-70-g09d2