2021-11-09 10:55:32 +01:00
|
|
|
function sgc {
|
|
|
|
case "$1" in
|
|
|
|
--help)
|
2021-11-09 11:26:47 +01:00
|
|
|
echo "Suche in der kompletten git-history nach "\$1""
|
2021-11-09 10:55:32 +01:00
|
|
|
echo "sgc = search git commit"
|
|
|
|
echo "sgc <suchbegriff>"
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
echo "Suchbegriff fehlt..."
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
git grep "$1" $(git rev-list --all)
|
|
|
|
esac
|
|
|
|
}
|
2021-10-23 14:29:05 +02:00
|
|
|
function m2m {
|
2021-11-09 10:55:16 +01:00
|
|
|
if [[ "$1" == "--help" ]]; then
|
2021-11-09 11:26:47 +01:00
|
|
|
echo "Sende Datei "\$2" per Mail; Betreff = "\$1""
|
2021-11-09 10:55:16 +01:00
|
|
|
echo "m2m = mail2me"
|
|
|
|
echo "m2m <Pfad zu Datei> <Betreff>"
|
|
|
|
else
|
|
|
|
if [ ! -f "$1" ]; then
|
|
|
|
echo "Dateipfad fehlt..."
|
|
|
|
else
|
|
|
|
if [ -z "$2" ]; then
|
|
|
|
echo "Betreff fehlt..."
|
|
|
|
else
|
|
|
|
echo "$1" | mail -s "$1" -A "$2" michael.grote@posteo.de
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2021-10-23 14:29:05 +02:00
|
|
|
}
|
2021-11-09 11:00:29 +01:00
|
|
|
function psk {
|
|
|
|
if [[ "$1" == "--help" ]]; then
|
2021-11-09 11:26:47 +01:00
|
|
|
echo "Beende Prozess "\$1""
|
2021-11-09 11:00:29 +01:00
|
|
|
echo "psk = ps kill"
|
|
|
|
echo "psk <prozessname>"
|
|
|
|
else
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Prozessname fehlt..."
|
|
|
|
else
|
2021-11-09 11:34:49 +01:00
|
|
|
ps -ef | grep "$1" | grep -v grep | awk '{ print $2 }' | xargs kill -9
|
2021-11-09 11:00:29 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2021-11-09 11:22:16 +01:00
|
|
|
function rgf {
|
|
|
|
if [[ "$1" == "--help" ]]; then
|
|
|
|
echo "Finde alle Dateien die "\$1" im Namen haben."
|
|
|
|
echo "rgf"
|
|
|
|
echo "rgf <string>"
|
|
|
|
else
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Suchbegriff fehlt..."
|
|
|
|
else
|
|
|
|
if [[ $(which rg) ]]; then
|
|
|
|
rg --files -g *"$1"* --hidden
|
|
|
|
else
|
|
|
|
echo "ripgrep ist nicht installiert... suche mit 'find'"
|
|
|
|
find . -type f -name *"$1"*
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2021-11-09 11:26:22 +01:00
|
|
|
function rgi {
|
|
|
|
if [[ "$1" == "--help" ]]; then
|
|
|
|
echo "Finde alle Dateien die "\$1" im Inhalt haben."
|
|
|
|
echo "rgi"
|
|
|
|
echo "rgi <string>"
|
|
|
|
else
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Suchbegriff fehlt..."
|
|
|
|
else
|
|
|
|
if [[ $(which rg) ]]; then
|
|
|
|
rg -i "$1"
|
|
|
|
else
|
|
|
|
echo "ripgrep ist nicht installiert... suche mit 'grep'"
|
|
|
|
grep -r -n -i "$1" .
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2021-11-09 11:32:43 +01:00
|
|
|
function ssh {
|
|
|
|
# benennt das aktuelle tmux-windows nach dem ssh-ziel
|
|
|
|
# baut ssh-verbindung auf
|
|
|
|
if [ -n "${TMUX}" ]; then
|
|
|
|
tmux rename-window "$*"
|
|
|
|
fi
|
|
|
|
command ssh "$@"
|
|
|
|
}
|