Don't run command with sudo for root.
This commit is contained in:
parent
102b8315ca
commit
57327f9d06
18
zshrc
18
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,11 +361,15 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
|
|||
|
||||
# Sudo
|
||||
function sudo() {
|
||||
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"
|
||||
if [ ${USER} = "root" ]; then
|
||||
"${@}"
|
||||
else
|
||||
command sudo -E env "PATH=$PATH" "$@"
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue