Download:
child 141:66e31ac77c94
parent 139:e8679f95a518
140:b39b7473c873
Anton Shestakov <av6@dwimlabs.net>, Thu, 22 Dec 2016 13:40:29 +0800
.hgeditor: modernize syntax and fix shellcheck warnings

1 файлов изменено, 6 вставок(+), 6 удалений(-) [+]
.hgeditor file | annotate | diff | comparison | revisions
--- a/.hgeditor Thu Dec 22 13:39:14 2016 +0800
+++ b/.hgeditor Thu Dec 22 13:40:29 2016 +0800
@@ -13,11 +13,11 @@
trap "cleanup_exit" 0 # normal exit
trap "exit 255" HUP INT QUIT ABRT TERM
-HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX)
-[ x$HGTMP != x -a -d $HGTMP ] || {
- echo "Could not create temporary directory! Exiting." 1>&2
- exit 1
-}
+HGTMP=$(mktemp -d "${TMPDIR-/tmp}/hgeditor.XXXXXX")
+if [ -z "$HGTMP" ] || ! [ -d "$HGTMP" ]; then
+ echo "Could not create temporary directory! Exiting." 1>&2
+ exit 1
+fi
(
grep '^HG: \(changed\|added\|removed\)' "$1" | cut -d ' ' -f 3- | while read changed; do
@@ -29,7 +29,7 @@
MD5=$(which md5sum 2>/dev/null) || \
MD5=$(which md5 2>/dev/null)
-[ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/msg"`
+[ -x "${MD5}" ] && CHECKSUM=$(${MD5} "$HGTMP/msg")
if [ -s "$HGTMP/diff" ]; then
vim -f "+e $HGTMP/diff" '+set buftype=help filetype=diff' "+vsplit $HGTMP/msg" '+setlocal spell' || exit $?
else