From 1162afefab45b7d9a0d9dd0402c03ffc76947139 Mon Sep 17 00:00:00 2001 From: B Stack Date: Wed, 22 Jul 2020 11:27:10 -0400 Subject: improve i-common in dpkg --- irfanview/debian/bin/irfanview-common | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'irfanview/debian/bin/irfanview-common') diff --git a/irfanview/debian/bin/irfanview-common b/irfanview/debian/bin/irfanview-common index 9c32c98..9dcb4b0 100755 --- a/irfanview/debian/bin/irfanview-common +++ b/irfanview/debian/bin/irfanview-common @@ -12,6 +12,7 @@ # 2019-06-16 replace winepath call with wine $WINEPATH_BIN # 2019-06-16 split into package-arch-specific and common scripts # 2020-05-20 handle multiple filenames correctly now, including removing \r from winepath output +# 2020-07-14 use echo binary instead of shell builtin # Usage: # called from irfanview (which is symlink to irfanview32 or ifanview64) # Do not use this by itself. @@ -25,7 +26,8 @@ then false else -IV_VERSION="2020-05-20a" +IV_VERSION="2020-07-14a" +echobin="$( which echo )" # Define functions expandword() { @@ -33,7 +35,7 @@ expandword() { # if file, add it # if directory, expand it # if tarball, extract it and operate on the directory like normal - local _word="$( echo "${@}" | sed -e 'sF\/\/F\/Fg;' )" + local _word="$( ${echobin} "${@}" | sed -e 'sF\/\/F\/Fg;' )" if test -d "${_word}"; then # loop through all files in the directory @@ -48,22 +50,22 @@ expandword() { *.tgz|*.tar.gz) # extract it and expand the temporary directory _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}" - echo "tmpdir ${_tmpdir}" + ${echobin} "tmpdir ${_tmpdir}" tar -zx -C "${_tmpdir}" -f "${_word}" expandword "${_tmpdir}" ;; *.zip) _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}" - echo "tmpdir ${_tmpdir}" - echo "7za e -w${_tmpdir} ${_word}" + ${echobin} "tmpdir ${_tmpdir}" + ${echobin} "7za e -w${_tmpdir} ${_word}" ( cd "${_tmpdir}" ; 7za e "${_word}" ; ) expandword "${_tmpdir}" ;; *) # assume it is readable and add it to list of files to open - echo "File:1 ${_word}" + ${echobin} "File:1 ${_word}" thisfile="$( getwinepath "${_word}" )" - echo "File:2 ${thisfile}" + ${echobin} "File:2 ${thisfile}" irfanfiles="${irfanfiles} '${thisfile}'" ;; esac @@ -86,11 +88,11 @@ for word in "${@}"; do expandword "${word}" done -irfanfiles="$( echo "${irfanfiles## }" | sed -r -e 's/\r//g;' )" +irfanfiles="$( ${echobin} "${irfanfiles## }" | sed -r -e 's/\r//g;' )" # run wine cd $WINEPREFIX -echo wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles} +${echobin} wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles} eval wine \"${IV_EXEC_PATH}\" "${irfanargs}" "${irfanfiles}" & wait %1 -- cgit