mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2025-05-24 19:14:39 +02:00
shell/aliases: only call pacman one time
This commit is contained in:
parent
62d1932eda
commit
78bbb4c3e7
1 changed files with 4 additions and 3 deletions
|
@ -57,11 +57,12 @@ if [ ! -z "$(type sudo 2>/dev/null)" -a "$USER" != 'root' ]; then
|
||||||
unset sudo
|
unset sudo
|
||||||
|
|
||||||
pacman(){
|
pacman(){
|
||||||
# Check if pacman has -R, -S or -U option
|
local sudo_needed
|
||||||
|
# Check if pacman has -S, -R or -U option
|
||||||
# which should indicate in most times if we need sudo
|
# which should indicate in most times if we need sudo
|
||||||
echo "$*" | grep -- "-[SRU]" >/dev/null 2>&1 \
|
echo "$*" | grep -- "-[SRU]" >/dev/null 2>&1 \
|
||||||
&& sudo /usr/bin/pacman $* \
|
&& sudo_needed="sudo"
|
||||||
|| /usr/bin/pacman $*
|
${sudo_needed} /usr/bin/pacman $*
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue