Move "s" (sudo alias) to a function to be able to run all aliases with sudo.
This commit is contained in:
parent
465d7853cc
commit
323437c2c9
12
zshrc
12
zshrc
|
@ -53,7 +53,6 @@ fi
|
||||||
# `man zshall` partie Aliasing: "If the text ends with a space, the next word in the shell input is treated as though it were in command position for
|
# `man zshall` partie Aliasing: "If the text ends with a space, the next word in the shell input is treated as though it were in command position for
|
||||||
# purposes of alias expansion. "
|
# purposes of alias expansion. "
|
||||||
alias sudo='sudo '
|
alias sudo='sudo '
|
||||||
alias s='sudo -E '
|
|
||||||
if [ ${USER} != "root" ]; then
|
if [ ${USER} != "root" ]; then
|
||||||
alias sc='sudo systemctl '
|
alias sc='sudo systemctl '
|
||||||
alias sd='sudo docker'
|
alias sd='sudo docker'
|
||||||
|
@ -359,12 +358,21 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
|
||||||
#####FONCTIONS
|
#####FONCTIONS
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
|
# Sudo
|
||||||
|
function s() {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
# SSH
|
# SSH
|
||||||
function clearsshkey() {
|
function clearsshkey() {
|
||||||
sed -i "${1}d" ~/.ssh/known_hosts
|
sed -i "${1}d" ~/.ssh/known_hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
## Verrouiller le shell avec vlock
|
## Verrouiller le shell avec vlock
|
||||||
#function TRAPALRM() { vlock }
|
#function TRAPALRM() { vlock }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue