Skip to content

Commit

Permalink
fixed more unbount variables
Browse files Browse the repository at this point in the history
  • Loading branch information
excalibur1234 committed Jan 28, 2018
1 parent d36fbe6 commit 6240a5e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pacui
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,16 @@ function func_m


echo " sudo pacdiff ..."
set +u # disable strict mode for environment variables
set +u # temporarily disable strict mode for environment variables

if [[ -n $DIFFPROG ]] # this if-condition avoids error message when $DIFFPROG is not set/empty
then
sudo pacdiff
else
# use pacdiff to search for .pacnew and .pacsave files. display both the original and the used config file using "pacui_diff" function defined above.
sudo DIFFPROG="pacui --diff" pacdiff
fi

set -u
echo ""

Expand Down Expand Up @@ -597,7 +599,7 @@ function func_r
;;

* ) # do this in all other cases
echo -e " \e[1m No input recognized. Remove process has been cancelled. \e[0m"
echo -e " \e[1m No input recognized. Removal of packages has been cancelled. \e[0m"
;;

esac
Expand Down Expand Up @@ -843,13 +845,17 @@ function func_b

if [[ -e /usr/bin/pacaur ]] # checks, whether file "pacaur" exists, i.e. pacaur is installed
then
set +u # temporarily disable strict mode for environment variables

# the cache location of pacaur is important for downgrading packages installed from the AUR or reinstalling removed packages from the AUR:
if [[ -z $AURDEST ]] # $AURDEST is environment variable for changing pacaur's default cache directory. check, if "AURDEST" variable is empty
then
cachePACAUR="$HOME/.cache/pacaur/"
else
cachePACAUR="$AURDEST"
fi

set -u
fi


Expand Down Expand Up @@ -1361,6 +1367,8 @@ function func_c
if [[ -n "$file" ]] && (( check == 1 )) # here $check variable needs to be 1 in order to continue normally and display files in a text editor.
then

set +u # temporarily disable strict mode for environment variables. "$EDITOR" variable gets used extensibely in the following code!

if [[ $( echo "$file" | cut -c -6 ) == "/home/" ]]
# if "file"'s first characters are "/home/", the "file" should NOT be opened as root!
then
Expand Down Expand Up @@ -1409,6 +1417,8 @@ function func_c
sudo $EDITOR "$file"
fi

set -u

fi

# cleanup
Expand Down Expand Up @@ -1968,6 +1978,8 @@ EOF
# pacaur sometimes does not find an editor to use and the --preview window in fzf does not show any package information.
# instead, it shows "::editor variable unset".

set +u # temporarily disable strict mode for environment variables

# check, whether pacaur is installed, user config file exists, $EDITOR variable is empty, "vi" is not installed:
if [[ -e /usr/bin/pacaur ]] && [[ ! -e $HOME/.config/pacaur/config ]] && [[ ! -n $EDITOR ]] && [[ ! -e /usr/bin/vi ]]
then
Expand All @@ -1976,6 +1988,8 @@ then
echo "editor='${EDITOR:-nano}'" >> "$HOME/.config/pacaur/config"
fi

set -u


# =======================

Expand Down

0 comments on commit 6240a5e

Please sign in to comment.