2015-05-18 Tom de Vries <tom@codesourcery.com>
* check_GNU_style.sh (g, ag, vg): Don't cat empty file.
From-SVN: r223284
+2015-05-18 Tom de Vries <tom@codesourcery.com>
+
+ * check_GNU_style.sh (g, ag, vg): Don't cat empty file.
+
2015-05-18 Tom de Vries <tom@codesourcery.com>
* check_GNU_style.sh (g, ag, vg, col): Declare local vars with local.
g (){
local msg="$1"
local arg="$2"
+
+ local found=false
cat $inp \
| egrep --color=always -- "$arg" \
- > $tmp && printf "\n$msg\n"
- cat $tmp
+ > "$tmp" && found=true
+
+ if $found; then
+ printf "\n$msg\n"
+ cat "$tmp"
+ fi
}
# And Grep
local msg="$1"
local arg1="$2"
local arg2="$3"
+
+ local found=false
cat $inp \
| egrep --color=always -- "$arg1" \
| egrep --color=always -- "$arg2" \
- > $tmp && printf "\n$msg\n"
- cat $tmp
+ > "$tmp" && found=true
+
+ if $found; then
+ printf "\n$msg\n"
+ cat "$tmp"
+ fi
}
# reVerse Grep
local msg="$1"
local varg="$2"
local arg="$3"
+
+ local found=false
cat $inp \
| egrep -v -- "$varg" \
| egrep --color=always -- "$arg" \
- > $tmp && printf "\n$msg\n"
- cat $tmp
+ > "$tmp" && found=true
+
+ if $found; then
+ printf "\n$msg\n"
+ cat "$tmp"
+ fi
}
col (){