Moved functions from sshrc file to functions.

This commit is contained in:
Stefan Gaiselmann 2021-02-06 20:10:12 +01:00
parent 34200536ad
commit 6524816618
2 changed files with 36 additions and 33 deletions

View File

@ -9,5 +9,39 @@ function getCertInfo() {
local myServer=${1:?a Servername is required}
local myPort=${2:-443}
echo | openssl s_client -showcerts -servername $myServer -connect $myServer:$myPort 2>/dev/null | openssl x509 -inform pem -noout -text
echo | openssl s_client -showcerts -servername "$myServer" -connect "$myServer":"$myPort" 2>/dev/null | openssl x509 -inform pem -noout -text
}
#
# Some functions (some by c't magazine)
#
# change directory and list
cdl() {
if cd "$@"; then
ls
fi
}
backup() {
# local @files = "$@"
for f in "$@"
do
if [ -d "$f" ]; then
cp -p -r "$f" "$f".backup-"$(date +%Y-%m-%d_%H_%M_%S)"
else
cp -p "$f" "$f".backup-"$(date +%Y-%m-%d_%H_%M_%S)"
fi
done
}
extract() {
case $1 in
*.tar.bz2) tar xvjf "$1";;
*.tar.gz|*.tgz) tar xvfz "$1";;
*.zip) unzip "$1";;
*) echo "Not supported: $1";;
esac
}
PATH=$PATH:$HOME/bin

View File

@ -1,13 +1,3 @@
#
# sshrc will be called byaliased ssh command 's'.
#
if [ -f $HOME/.profile ] && [ "$SOURCE_PROFILE" = "true" ]; then
source $HOME/.profile
fi
if [ -f $HOME/.bashrc ] && [ "$SOURCE_BASHRC" = "true" ]; then
source $HOME/.bashrc
fi
#
# System Name and type detectedn
#
@ -43,7 +33,7 @@ fg_reset="\[\e[39m\]"
fg_system="${sol_base3}"
{{- if eq .bash.prompt.category "Materna" }}
# Materna cyan
# Materna cyan
bg_system="${sol_bg_cyan}"
fg_type="${sol_cyan}"
{{- else if eq .bash.prompt.category "AWS" }}
@ -106,25 +96,4 @@ alias ls='ls $LS_OPTIONS'
alias psg='ps -aux | grep -v grep | grep '
# Some functions (some by c't magazine)
cdl() {
cd "$@"
if [ "$?" == 0 ]; then
ls
fi
}
backup() {
cp -p "$@" "$@".backup-$(date +%Y-%m-%d_%H_%M_%S)
}
extract() {
case $1 in
*.tar.bz2) tar xvjf $1;;
*.tar.gz|*.tgz) tar xvfz $1;;
*.zip) unzip $1;;
*) echo "Not supported: $1";;
esac
}
PATH=$PATH:$HOME/bin