mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2026-01-29 01:13:01 +01:00
shell/mysqlpw: remove
This commit is contained in:
parent
aecf642bcf
commit
8768092262
2 changed files with 0 additions and 40 deletions
|
|
@ -41,7 +41,6 @@
|
||||||
~/.profile.d/10-liquidprompt.sh: shell/liquidprompt.sh
|
~/.profile.d/10-liquidprompt.sh: shell/liquidprompt.sh
|
||||||
~/.profile.d/20-aliases.sh: shell/aliases.sh
|
~/.profile.d/20-aliases.sh: shell/aliases.sh
|
||||||
~/.profile.d/20-cd.sh: shell/cd.sh
|
~/.profile.d/20-cd.sh: shell/cd.sh
|
||||||
~/.profile.d/40-mysqlpw.sh: shell/mysqlpw.sh
|
|
||||||
~/.profile.d/81-fzf.sh: shell/fzf.sh
|
~/.profile.d/81-fzf.sh: shell/fzf.sh
|
||||||
~/.profile.d/82-direnv.sh: shell/direnv.sh
|
~/.profile.d/82-direnv.sh: shell/direnv.sh
|
||||||
~/.profile.d/90-keychain.sh: shell/keychain.sh
|
~/.profile.d/90-keychain.sh: shell/keychain.sh
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#The function will find the given user and search for a mysql-password
|
|
||||||
#in the home-directory, which will get printed out!
|
|
||||||
#arg1: user where to find a config-file
|
|
||||||
# if not given, it uses the current user in the $HOME and $USER-Variable
|
|
||||||
|
|
||||||
mysqlpw() {
|
|
||||||
_mysqlpw_H=$HOME
|
|
||||||
_mysqlpw_U=$USER
|
|
||||||
|
|
||||||
# use different user, if arg1 given
|
|
||||||
if [ -n "$1" ]; then
|
|
||||||
|
|
||||||
# check if given user is even existing
|
|
||||||
if ! id "$1" >/dev/null 2>/dev/null; then
|
|
||||||
echo user "$1" not existing >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
_mysqlpw_U=$1
|
|
||||||
_mysqlpw_H=$(grep ^"$1": /etc/passwd | cut -d ":" -f 6)
|
|
||||||
|
|
||||||
fi;
|
|
||||||
|
|
||||||
_mysqlpw_cnf="$_mysqlpw_H/.my.cnf"
|
|
||||||
|
|
||||||
if [ ! -e "$_mysqlpw_cnf" ]; then
|
|
||||||
echo "$_mysqlpw_cnf" not existing >&2 && return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -r "$_mysqlpw_cnf" ]; then
|
|
||||||
echo "$_mysqlpw_cnf" not readable >&2 && return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
_mysqlpw_PW=$( (grep "password=" "$_mysqlpw_cnf" || echo undefined) | cut -d "=" -f 2)
|
|
||||||
|
|
||||||
echo MySQL-Password for user "$_mysqlpw_U" is "$_mysqlpw_PW"
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue