terminate-psql-sessions: Fix shellcheck warnings.

In scripts/setup/terminate-psql-sessions line 5:
    [ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
              ^-- SC2006: Use $(..) instead of legacy `..`.
                          ^-- SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n".

In scripts/setup/terminate-psql-sessions line 20:
major=$(echo $version | cut -d. -f1,2)
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In scripts/setup/terminate-psql-sessions line 24:
tables=$(echo "'$@'" | sed "s/ /','/g")
                ^-- SC2145: Argument mixes string and array. Use * or separate argument.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-03 00:14:48 +00:00 committed by Tim Abbott
parent 5a5497c6a1
commit 26d378fb7d
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
set -e
vergte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
[ "$1" = "$(echo -e "$1\\n$2" | sort -V | tail -n1)" ]
}
DEFAULT_USER="postgres"
@ -17,11 +17,11 @@ else
version=$(psql -A -t -d postgres -c "show server_version")
fi
major=$(echo $version | cut -d. -f1,2)
major=$(echo "$version" | cut -d. -f1,2)
username=$1
shift
tables=$(echo "'$@'" | sed "s/ /','/g")
tables=$(echo "'$*'" | sed "s/ /','/g")
if vergte "$major" "9.2"; then
pidname="pid"
else