Restructure functions

This commit is contained in:
斟酌 鵬兄 2022-08-12 00:39:41 +08:00
parent 5fe9b2ef34
commit 123b2942e9
4 changed files with 21 additions and 29 deletions

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# ssh-agent key lifetime
alias ssh-add="ssh-add -t 43200"
SSH_ENV="$HOME/.ssh/environment" SSH_ENV="$HOME/.ssh/environment"
function start_agent { function start_agent {

View File

@ -25,17 +25,12 @@ alias p4='pushd +4'
alias o=popd alias o=popd
alias d='dirs -v' alias d='dirs -v'
# fast greps # default grep opts
alias grep='grep --color=auto --exclude=\.svn' alias grep='grep --color=auto --exclude-dir .git'
alias grepphp='grep -n --include=*.php'
alias grepjs='grep -n --include=*.js'
# Wget prefix # Wget prefix
alias wget='wget --directory-prefix="$HOME/Downloads"' alias wget='wget --directory-prefix="$HOME/Downloads"'
# ssh-agent key lifetime
alias ssh-add="ssh-add -t 43200"
# Pretty print sqlite3 # Pretty print sqlite3
alias sqlite3="sqlite3 -header -column" alias sqlite3="sqlite3 -header -column"

View File

@ -1,28 +1,9 @@
#!/bin/bash #!/bin/bash
function grepmysql () { alias grepphp='grep -n --include=*.php'
if [[ -z "$1" ]]; then alias grepjs='grep -n --include=*.js'
__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 () { function grept {
if [[ -z "$1" ]]; then
__func_head "DB_NAME"
echo
else
grep $1 ~/.db_pass | awk 'BEGIN{FS=":"}{ print $2 }'
fi
}
function greptype() {
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
__func_head "TYPE GREP_ARGS" __func_head "TYPE GREP_ARGS"
echo echo

View File

@ -1,5 +1,18 @@
#!/bin/bash #!/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 () { function mysqlo () {
if [ -z "$1" ]; then if [ -z "$1" ]; then
__func_head "SERVER_NAME" __func_head "SERVER_NAME"