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 sn='sudo nft list ruleset'
|
||||
alias sp='sudo puppet agent -t '
|
||||
alias sv='sudo -E vi '
|
||||
alias sz='sudo -E zsh'
|
||||
alias sv='sudo vi '
|
||||
alias sz='sudo zsh'
|
||||
else
|
||||
alias sc='systemctl '
|
||||
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'
|
||||
|
||||
# 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
|
||||
|
@ -361,12 +361,16 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
|
|||
|
||||
# Sudo
|
||||
function sudo() {
|
||||
if [ ${USER} = "root" ]; then
|
||||
"${@}"
|
||||
else
|
||||
if alias "${1}" &> /dev/null ; then
|
||||
#$(type "$1" | sed -E 's/^.*`(.*).$/\1/') "${@:2}"
|
||||
command -v "${1}" | \grep -o -P "(?<=\').*(?=')" | xargs sudo -E env "PATH=$PATH"
|
||||
else
|
||||
command sudo -E env "PATH=$PATH" "$@"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# SSH
|
||||
|
|
Loading…
Reference in New Issue