From dbbd2e1c6583f33c31e3e4605bc640879740a45d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 7 Nov 2016 05:27:43 +0300 Subject: bugfix & code style --- %HOME%/.bash_utils/cxx.sh | 4 ++-- %HOME%/.bash_utils/distr.sh | 2 +- %HOME%/.bash_utils/path.sh | 2 +- %HOME%/.bash_utils/text.sh | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) (limited to '%HOME%/.bash_utils') diff --git a/%HOME%/.bash_utils/cxx.sh b/%HOME%/.bash_utils/cxx.sh index 4ff81f4..7fb9714 100644 --- a/%HOME%/.bash_utils/cxx.sh +++ b/%HOME%/.bash_utils/cxx.sh @@ -72,7 +72,7 @@ runc() ( local build_dir build_dir="$( mktemp --directory )" - trap "$( printf 'popd > /dev/null && rm -rf -- %q' "$build_dir" )" 0 + trap "$( printf -- 'popd > /dev/null && rm -rf -- %q' "$build_dir" )" 0 pushd "$build_dir" > /dev/null local output_name @@ -152,7 +152,7 @@ runcxx() ( local build_dir build_dir="$( mktemp --directory )" - trap "$( printf 'popd > /dev/null && rm -rf -- %q' "$build_dir" )" 0 + trap "$( printf -- 'popd > /dev/null && rm -rf -- %q' "$build_dir" )" 0 pushd "$build_dir" > /dev/null local output_name diff --git a/%HOME%/.bash_utils/distr.sh b/%HOME%/.bash_utils/distr.sh index 799f52f..252f86c 100644 --- a/%HOME%/.bash_utils/distr.sh +++ b/%HOME%/.bash_utils/distr.sh @@ -75,7 +75,7 @@ sums_update_distr() ( while IFS= read -d '' -r path; do paths+=("$path") - done < <( find . -type f -\( -iname '*.exe' -o -iname '*.iso' -\) -printf '%P\0' ) + done < <( find -type f -\( -iname '*.exe' -o -iname '*.iso' -\) -printf '%P\0' ) sums_update ${paths[@]+"${paths[@]}"} ) diff --git a/%HOME%/.bash_utils/path.sh b/%HOME%/.bash_utils/path.sh index 4aff550..13b5b00 100644 --- a/%HOME%/.bash_utils/path.sh +++ b/%HOME%/.bash_utils/path.sh @@ -21,7 +21,7 @@ add_missing_path() ( for path; do if str_contains "$path" ':'; then - echo "${FUNCNAME[0]}: mustn't contain colons: $path" >&2 + echo "${FUNCNAME[0]}: mustn't contain colon (':') characters: $path" >&2 return 1 fi done diff --git a/%HOME%/.bash_utils/text.sh b/%HOME%/.bash_utils/text.sh index 242837f..aefe453 100644 --- a/%HOME%/.bash_utils/text.sh +++ b/%HOME%/.bash_utils/text.sh @@ -81,13 +81,13 @@ str_starts_with() ( if [ "$#" -ne 2 ]; then echo "usage: ${FUNCNAME[0]} STR SUB" return 1 - fi + fi - local str="$1" - local sub - sub="$( printf -- '%q' "$2" )" + local str="$1" + local sub + sub="$( printf -- '%q' "$2" )" - test "$str" != "${str#$sub}" + test "$str" != "${str#$sub}" ) str_split() ( @@ -136,7 +136,7 @@ str_split() ( IFS="$old_delim" read -a xs -r <<< "$str" for x in ${xs[@]+"${xs[@]}"}; do - printf "$fmt" "$x" + printf -- "$fmt" "$x" done ) -- cgit v1.2.3