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_profile | 2 +- %HOME%/.bash_utils/cxx.sh | 4 ++-- %HOME%/.bash_utils/distr.sh | 2 +- %HOME%/.bash_utils/path.sh | 2 +- %HOME%/.bash_utils/text.sh | 12 ++++++------ %HOME%/.profile | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/%HOME%/.bash_profile b/%HOME%/.bash_profile index 91b1d50..dbdce8d 100644 --- a/%HOME%/.bash_profile +++ b/%HOME%/.bash_profile @@ -8,7 +8,7 @@ spawn_ssh_agent() { command -v ssh-agent &> /dev/null \ && eval "$( ssh-agent -s )" > /dev/null \ && [ -n "${SSH_AGENT_PID:+x}" ] \ - && trap "$( printf 'kill %q' "$SSH_AGENT_PID" )" 0 + && trap "$( printf -- 'kill %q' "$SSH_AGENT_PID" )" 0 } spawn_ssh_agent 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 ) diff --git a/%HOME%/.profile b/%HOME%/.profile index 43c0e81..f107b3f 100644 --- a/%HOME%/.profile +++ b/%HOME%/.profile @@ -1,5 +1,5 @@ LANG="$( locale --no-unicode --utf )" && export LANG -[ -n "${BASH_VERSION+x}" ] \ +[ -n "${BASH_VERSION+x}" ] \ && [ -r "$HOME/.bashrc" ] \ && source "$HOME/.bashrc" -- cgit v1.2.3