commit:     a468a995ba3e5931971804bdda485a88e68b0e18
Author:     kewl fft <kewl <AT> alto <DOT> eu <DOT> org>
AuthorDate: Sat May 26 06:05:59 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat May 26 06:29:21 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a468a995

etc-update: consistently use double bracket operator

Closes: https://github.com/gentoo/portage/pull/323

 bin/etc-update | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/bin/etc-update b/bin/etc-update
index 4f02876ef..afdd48ce8 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -146,8 +146,8 @@ scan() {
                find_opts+=( "$name_opt" )
                find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print )
 
-               if [ ! -w "${path}" ] ; then
-                       [ -e "${path}" ] || continue
+               if [[ ! -w ${path} ]] ; then
+                       [[ -e ${path} ]] || continue
                        die "Need write access to ${path}"
                fi
 
@@ -383,7 +383,7 @@ read_int() {
 }
 
 do_file() {
-       interactive_echo() { [ "${OVERWRITE_ALL}" != "yes" ] && [ 
"${DELETE_ALL}" != "yes" ] && echo; }
+       interactive_echo() { [[ ${OVERWRITE_ALL} != yes ]] && [[ ${DELETE_ALL} 
!= yes ]] && echo; }
        interactive_echo
        local -i my_input
        local -i linecnt
@@ -541,17 +541,17 @@ do_cfg() {
                case ${my_input} in
                        1)      echo "Replacing ${ofile} with ${file}"
                                do_mv_ln ${mv_opts} "${file}" "${ofile}"
-                               [ -n "${OVERWRITE_ALL}" ] && my_input=-1
+                               [[ -n ${OVERWRITE_ALL} ]] && my_input=-1
                                continue
                                ;;
                        2)      echo "Deleting ${file}"
                                rm ${rm_opts} "${file}"
-                               [ -n "${DELETE_ALL}" ] && my_input=-1
+                               [[ -n ${DELETE_ALL} ]] && my_input=-1
                                continue
                                ;;
                        3)      do_merge "${file}" "${ofile}"
                                my_input=${?}
-#                              [ ${my_input} == 255 ] && my_input=-1
+#                              [[ ${my_input} == 255 ]] && my_input=-1
                                continue
                                ;;
                        4)      continue
@@ -696,10 +696,10 @@ die() {
        trap SIGINT
        local msg=$1 exitcode=${2:-1}
 
-       if [ ${exitcode} -eq 0 ] ; then
+       if [[ ${exitcode} -eq 0 ]] ; then
                ${QUIET} || printf 'Exiting: %b\n' "${msg}"
                scan > /dev/null
-               ! ${QUIET} && [ ${count} -gt 0 ] && echo "NOTE: ${count} 
updates remaining"
+               ! ${QUIET} && [[ ${count} -gt 0 ]] && echo "NOTE: ${count} 
updates remaining"
        else
                error "${msg}"
        fi

Reply via email to