bash: add function sar
This commit is contained in:
parent
19a2342707
commit
72ebf77558
1 changed files with 284 additions and 256 deletions
30
.bash_extra
30
.bash_extra
|
@ -30,7 +30,7 @@ export GIT_PS1_SHOWUPSTREAM="verbose"
|
||||||
export GIT_PS1_SHOWCONFLICTSTATE="yes"
|
export GIT_PS1_SHOWCONFLICTSTATE="yes"
|
||||||
export PS1="\n${BLUE}\u${GREEN}@${ORANGE}\$(cat /etc/hostname) \$(pwd | sed -E -e "s#/#${RED}/${RESET}${GREEN}#g")${YELLOW}\$(__git_ps1)${RESET}\n> "
|
export PS1="\n${BLUE}\u${GREEN}@${ORANGE}\$(cat /etc/hostname) \$(pwd | sed -E -e "s#/#${RED}/${RESET}${GREEN}#g")${YELLOW}\$(__git_ps1)${RESET}\n> "
|
||||||
# https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly
|
# https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly
|
||||||
# alle Farben sind mit \[<wert>\] escaped, sonst kann die shelle die länge nicht richtig ausrechnen
|
# alle Farben sind mit \[<wert>\] escaped, sonst kann die shell die länge nicht richtig ausrechnen
|
||||||
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
|
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
|
||||||
# https://gist.github.com/justintv/168835
|
# https://gist.github.com/justintv/168835
|
||||||
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||||
|
@ -217,6 +217,34 @@ ghist() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
function sar {
|
||||||
|
case "$1" in
|
||||||
|
--help | -h)
|
||||||
|
cat <<EOF
|
||||||
|
Description:
|
||||||
|
Search and replace recursively.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
sar [--help] <search> <replace>
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Print this help.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
michael.grote@posteo.de - git.mgrote.net
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ "$1" != "-h" ] && [ "$1" != "--help" ] ; then
|
||||||
|
if [ $# = 2 ] ; then
|
||||||
|
find . -name '*' -type f -not -path '*/\.git/*' -exec sed -i "s/$1/$2/" {} \;
|
||||||
|
elif [ $# = 1 ] ; then
|
||||||
|
echo ">>> Not enough arguments..."
|
||||||
|
elif [ $# -gt 2 ] ; then
|
||||||
|
echo ">>> Too many arguments..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
### Aliase
|
### Aliase
|
||||||
# tmux
|
# tmux
|
||||||
|
|
Loading…
Reference in a new issue