penguin/utils

my env utils

commit 123b2942e9999671de2dc9f5afb96c88348fcd42

author斟酌 鵬兄 <tgckpg@gmail.com>
date2022-08-11T16:39:41Z
subjectRestructure functions
commit 123b2942e9999671de2dc9f5afb96c88348fcd42
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2022-08-11T16:39:41Z

    Restructure functions
---
 bash/bashrc/sources/09_ssh-agent  |  3 +++
 bash/bashrc/sources/10_aliases    |  9 ++-------
 bash/bashrc/sources/20_fast-greps | 25 +++----------------------
 bash/bashrc/sources/30_mysql      | 13 +++++++++++++
 4 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/bash/bashrc/sources/09_ssh-agent b/bash/bashrc/sources/09_ssh-agent
index 40ec3c9..440f103 100755
--- a/bash/bashrc/sources/09_ssh-agent
+++ b/bash/bashrc/sources/09_ssh-agent
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+# ssh-agent key lifetime
+alias ssh-add="ssh-add -t 43200"
+
 SSH_ENV="$HOME/.ssh/environment"
 
 function start_agent {
diff --git a/bash/bashrc/sources/10_aliases b/bash/bashrc/sources/10_aliases
index cb5b644..d257948 100755
--- a/bash/bashrc/sources/10_aliases
+++ b/bash/bashrc/sources/10_aliases
@@ -25,17 +25,12 @@ alias p4='pushd +4'
 alias o=popd
 alias d='dirs -v'
 
-# fast greps
-alias grep='grep --color=auto --exclude=\.svn'
-alias grepphp='grep -n --include=*.php'
-alias grepjs='grep -n --include=*.js'
+# default grep opts
+alias grep='grep --color=auto --exclude-dir .git'
 
 # Wget prefix
 alias wget='wget --directory-prefix="$HOME/Downloads"'
 
-# ssh-agent key lifetime
-alias ssh-add="ssh-add -t 43200"
-
 # Pretty print sqlite3
 alias sqlite3="sqlite3 -header -column"
 
diff --git a/bash/bashrc/sources/20_fast-greps b/bash/bashrc/sources/20_fast-greps
index 8a08a9f..2fc30c2 100755
--- a/bash/bashrc/sources/20_fast-greps
+++ b/bash/bashrc/sources/20_fast-greps
@@ -1,28 +1,9 @@
 #!/bin/bash
 
-function grepmysql () {
-    if [[ -z "$1" ]]; then
-        __func_head "MySQL_SERVER_NAME [WITH_OPTIONS]"
-        echo
-    else
-        if [[ -z "$2" ]]; then
-            grep -i $1 ~/.mysql_pass | awk 'BEGIN{FS=":"}{ print $2 }'
-        else
-            grep -i $1 ~/.mysql_pass | awk 'BEGIN{FS=":"}{ print $2" "$3 }'
-        fi
-    fi
-}
-
-function grepdb () {
-    if [[ -z "$1" ]]; then
-        __func_head "DB_NAME"
-        echo
-    else
-        grep $1 ~/.db_pass | awk 'BEGIN{FS=":"}{ print $2 }'
-    fi
-}
+alias grepphp='grep -n --include=*.php'
+alias grepjs='grep -n --include=*.js'
 
-function greptype() {
+function grept {
     if [[ -z "$1" ]]; then
         __func_head "TYPE GREP_ARGS"
         echo
diff --git a/bash/bashrc/sources/30_mysql b/bash/bashrc/sources/30_mysql
index 01d4682..1c0a766 100755
--- a/bash/bashrc/sources/30_mysql
+++ b/bash/bashrc/sources/30_mysql
@@ -1,5 +1,18 @@
 #!/bin/bash
 
+function grepmysql {
+    if [[ -z "$1" ]]; then
+        __func_head "MySQL_SERVER_NAME [WITH_OPTIONS]"
+        echo
+    else
+        if [[ -z "$2" ]]; then
+            grep -i $1 ~/.mysql_pass | awk 'BEGIN{FS=":"}{ print $2 }'
+        else
+            grep -i $1 ~/.mysql_pass | awk 'BEGIN{FS=":"}{ print $2" "$3 }'
+        fi
+    fi
+}
+
 function mysqlo () {
     if [ -z "$1" ]; then
         __func_head "SERVER_NAME"