diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-06 14:54:33 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-06 14:54:33 +1200 |
commit | fdfe1fe72f8fe358d2b64ddc9e1b58dda4d3ba90 (patch) | |
tree | 75374be5bee4e0f36f3020958fb99e8fb46e4385 /bash/bashrc.d/mysql.bash | |
parent | Avoid command substitution inline declaration (diff) | |
download | dotfiles-fdfe1fe72f8fe358d2b64ddc9e1b58dda4d3ba90.tar.gz dotfiles-fdfe1fe72f8fe358d2b64ddc9e1b58dda4d3ba90.zip |
Separate declaration from assignment
Diffstat (limited to 'bash/bashrc.d/mysql.bash')
-rw-r--r-- | bash/bashrc.d/mysql.bash | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bash/bashrc.d/mysql.bash b/bash/bashrc.d/mysql.bash index 97bb1764..973542b8 100644 --- a/bash/bashrc.d/mysql.bash +++ b/bash/bashrc.d/mysql.bash @@ -9,7 +9,8 @@ # password=SsJ2pICe226jM # mysql() { - local config=$HOME/.mysql/$1.cnf + local config + config=$HOME/.mysql/$1.cnf if [[ -r $config ]] ; then shift command mysql --defaults-extra-file="$config" "$@" @@ -20,10 +21,12 @@ mysql() { # Completion setup for MySQL for configured databases _mysql() { - local word=${COMP_WORDS[COMP_CWORD]} + local word + word=${COMP_WORDS[COMP_CWORD]} # Check directory exists and has at least one .cnf file - local dir=$HOME/.mysql + local dir + dir=$HOME/.mysql if [[ ! -d $dir ]] || ( shopt -s nullglob dotglob declare -a files=("$dir"/*.cnf) @@ -33,7 +36,8 @@ _mysql() { fi # Return the names of the .cnf files sans prefix as completions - local -a items=("$dir"/*.cnf) + local -a items + items=("$dir"/*.cnf) items=("${items[@]##*/}") items=("${items[@]%%.cnf}") COMPREPLY=( $(compgen -W "${items[*]}" -- "$word") ) |