Don't run command with sudo for root.
This commit is contained in:
parent
102b8315ca
commit
57327f9d06
10
zshrc
10
zshrc
|
@ -60,8 +60,8 @@ if [ ${USER} != "root" ]; then
|
||||||
alias sj='sudo journalctl '
|
alias sj='sudo journalctl '
|
||||||
alias sn='sudo nft list ruleset'
|
alias sn='sudo nft list ruleset'
|
||||||
alias sp='sudo puppet agent -t '
|
alias sp='sudo puppet agent -t '
|
||||||
alias sv='sudo -E vi '
|
alias sv='sudo vi '
|
||||||
alias sz='sudo -E zsh'
|
alias sz='sudo zsh'
|
||||||
else
|
else
|
||||||
alias sc='systemctl '
|
alias sc='systemctl '
|
||||||
alias sd='docker'
|
alias sd='docker'
|
||||||
|
@ -144,7 +144,7 @@ fi
|
||||||
alias wotgobblemem='ps -o time,ppid,pid,nice,pcpu,pmem,user,comm -A | sort -n -k 6 | tail -15'
|
alias wotgobblemem='ps -o time,ppid,pid,nice,pcpu,pmem,user,comm -A | sort -n -k 6 | tail -15'
|
||||||
|
|
||||||
# Afficher uniquement le processus à partir de ps
|
# Afficher uniquement le processus à partir de ps
|
||||||
alias px='ps faux|grep -v grep|grep -i -e VSZ -e --'
|
alias px='ps faux|grep -v grep|grep -i -e VSZ -e '
|
||||||
|
|
||||||
|
|
||||||
# Décompression
|
# Décompression
|
||||||
|
@ -361,12 +361,16 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
|
||||||
|
|
||||||
# Sudo
|
# Sudo
|
||||||
function sudo() {
|
function sudo() {
|
||||||
|
if [ ${USER} = "root" ]; then
|
||||||
|
"${@}"
|
||||||
|
else
|
||||||
if alias "${1}" &> /dev/null ; then
|
if alias "${1}" &> /dev/null ; then
|
||||||
#$(type "$1" | sed -E 's/^.*`(.*).$/\1/') "${@:2}"
|
#$(type "$1" | sed -E 's/^.*`(.*).$/\1/') "${@:2}"
|
||||||
command -v "${1}" | \grep -o -P "(?<=\').*(?=')" | xargs sudo -E env "PATH=$PATH"
|
command -v "${1}" | \grep -o -P "(?<=\').*(?=')" | xargs sudo -E env "PATH=$PATH"
|
||||||
else
|
else
|
||||||
command sudo -E env "PATH=$PATH" "$@"
|
command sudo -E env "PATH=$PATH" "$@"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# SSH
|
# SSH
|
||||||
|
|
Loading…
Reference in New Issue