Moved functions from sshrc file to functions.
This commit is contained in:
parent
34200536ad
commit
6524816618
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user