change gmo-cfg.sh
This commit is contained in:
parent
c0c2e4200a
commit
b20224c084
@ -1,3 +1,17 @@
|
||||
# source IA
|
||||
# check if is a scp connexion
|
||||
is_scp() {
|
||||
# If SSH_ORIGINAL_COMMAND is defined and contains "scp"
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" && "$SSH_ORIGINAL_COMMAND" == scp* ]]; then
|
||||
return 0
|
||||
fi
|
||||
# if script name ($0) contains "scp"
|
||||
if [[ "$0" == *scp* ]]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# source prompt color: https://robotmoon.com/bash-prompt-generator/^
|
||||
if [ $(whoami) == "gilles" ]; then
|
||||
#export PS1="\[\033[0;32m\][\[\033[1;94m\]\u\[\033[0;33m\]@\h \[\033[0;32m\]\W]# \[\033[0;37m\]"
|
||||
@ -17,13 +31,16 @@ alias mv='mv -i'
|
||||
alias ls='ls --color=auto'
|
||||
alias sudo='sudo --preserve-env=PATH env' # https://www.petefreitag.com/blog/environment-variables-sudo/
|
||||
|
||||
if [[ "$USER" == "gilles" || "$USER" == "root" ]]; then
|
||||
dist=$(cat /etc/redhat-release)
|
||||
kern=$(uname -r)
|
||||
cat << EOF
|
||||
if [ ! is_scp ]; then
|
||||
if [[ "$USER" == "gilles" || "$USER" == "root" ]]; then
|
||||
dist=$(cat /etc/redhat-release)
|
||||
kern=$(uname -r)
|
||||
cat << EOF
|
||||
|
||||
Distribution: $dist
|
||||
Kernel: $kern
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
# execute only if user is gilles or root
|
||||
#if [[ "$USER" == "gilles" || "$USER" == "root" ]]; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user