diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-02 00:28:01 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-02 00:28:33 +0300 |
commit | 92ffc06a6bdf654be60c22c345c15d4dba19efde (patch) | |
tree | 0826f2d9f269e25603adcc7d85e121a3f813cb06 /%HOME%/.bash_utils | |
parent | .local/bin: add comments to scripts (diff) | |
download | linux-home-92ffc06a6bdf654be60c22c345c15d4dba19efde.tar.gz linux-home-92ffc06a6bdf654be60c22c345c15d4dba19efde.zip |
.bash_utils: remove mysql.sh
WTF did I even need that for?
Diffstat (limited to '%HOME%/.bash_utils')
-rw-r--r-- | %HOME%/.bash_utils/mysql.sh | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/%HOME%/.bash_utils/mysql.sh b/%HOME%/.bash_utils/mysql.sh deleted file mode 100644 index d7c8e18..0000000 --- a/%HOME%/.bash_utils/mysql.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com> -# This file is part of the "linux-home" project. -# For details, see https://github.com/egor-tensin/linux-home. -# Distributed under the MIT License. - -_runsql_check_var() ( - set -o errexit -o nounset -o pipefail - - local prefix="${FUNCNAME[0]}" - [ "${#FUNCNAME[@]}" -gt 1 ] && prefix="${FUNCNAME[1]}" - - local var_name - for var_name; do - if [ -z "${!var_name:+x}" ]; then - echo "$prefix: $var_name is not set" >&2 - return 1 - fi - done -) - -runsql() ( - set -o errexit -o nounset -o pipefail - - _runsql_check_var MYSQL_USER MYSQL_PASSWORD MYSQL_HOST - local MYSQL_PORT="${MYSQL_PORT:-3306}" - - local -a args - local stmt - for stmt; do - args+=(-e "$stmt") - done - - if [ -n "${MYSQL_DATABASE:+x}" ]; then - args+=("$MYSQL_DATABASE") - fi - - mysql \ - --no-auto-rehash \ - --user="$MYSQL_USER" \ - --password="$MYSQL_PASSWORD" \ - --host="$MYSQL_HOST" \ - --port="$MYSQL_PORT" \ - "${args[@]}" -) |