shell/aliases 'pacman -U' with sudo

This commit is contained in:
Felix Buehler 2017-02-14 12:15:53 +01:00
parent 10f4f82a3b
commit 71f08132a4

View file

@ -56,9 +56,9 @@ if [ ! -z "$(type sudo 2>/dev/null)" -a "$USER" != 'root' ]; then
unset sudo
pacman(){
# Check if pacman has -R or -S option
# Check if pacman has -R, -S or -U option
# which should indicate in most times if we need sudo
echo "$*" | grep -- "-[SR]" >/dev/null 2>&1 \
echo "$*" | grep -- "-[SRU]" >/dev/null 2>&1 \
&& sudo /usr/bin/pacman $* \
|| /usr/bin/pacman $*
}