Structual bashrc

This commit is contained in:
2014-08-04 17:40:25 +08:00
parent 56a34a1f12
commit 00e123d9fa
8 changed files with 180 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
#!/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
}
function greptype() {
if [[ -z "$1" ]]; then
__func_head "TYPE GREP_ARGS"
echo
else
CMD="grep --color=auto -n --include=*.$1"
shift
$CMD $@
fi
}