diff options
author | Joseph Herlant <aerostitch@debian.org> | 2019-08-30 12:00:54 -0700 |
---|---|---|
committer | jkoan <jkoan@users.noreply.github.com> | 2019-08-31 14:10:15 +0200 |
commit | fbd0b044053f9158f106ff38e0c02c71a7474122 (patch) | |
tree | 3cfa821cac2e4648600e855fdfa7717bd8f915fc /navit/tools | |
parent | bcc10a828e53153b5bda731f6fbb3f0f6fb4aec1 (diff) | |
download | navit-fbd0b044053f9158f106ff38e0c02c71a7474122.tar.gz |
Refactoring:tools: Check exit code directly with e.g. "if mycmd;", not indirectly with $?
Diffstat (limited to 'navit/tools')
-rwxr-xr-x | navit/tools/cleanattr.sh | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/navit/tools/cleanattr.sh b/navit/tools/cleanattr.sh index 200db5b66..c5e36792a 100755 --- a/navit/tools/cleanattr.sh +++ b/navit/tools/cleanattr.sh @@ -20,8 +20,8 @@ if [ -f $TMPFILE ] ; then exit 1; fi -touch $TMPFILE -if [ $? -ne 0 ] ; then +if ! touch $TMPFILE +then echo "Could not write to temporary file $TEMPFILE." echo "Please make sure you have write access to the temporary directory." exit 1; @@ -35,9 +35,8 @@ cp $ATTRFILE $TMPFILE for ATTRNAME in $ATTRLIST ; do ATTR="attr_$ATTRNAME" - grep -rI $ATTR ./* > /dev/null - - if [ $? -ne 0 ] ; then + if ! grep -rI $ATTR ./* > /dev/null + then echo "Unused attribute: $ATTR" grep -v "ATTR($ATTRNAME)" $TMPFILE > $TMPFILE2 mv $TMPFILE2 $TMPFILE |