[Open-FCoE] [PATCH] fcoe-utils: Add debug/ directory and dcbcheck.sh script

Robert Love robert.w.love at intel.com
Tue Apr 14 16:46:21 UTC 2009


On Mon, 2009-04-13 at 15:20 -0700, Joe Eykholt wrote:
> Robert Love wrote:
<snip>
> BTW, you could use grep -q instead of grep -c.
> 
> Instead of:
> 
> 	if [ `dcbtool gc ${IFNAME} app:0 | grep Enable | grep -c true` -ne 1 ] ; then
> 
> do:
> 	if dcbtool gc ${IFNAME} app:0 | grep Enable | grep -q true ; then : ; else
> 		echo ...
> 
> To further simplify (but possibly obscure):
> 
> 	dcbtool gc ${IFNAME} app:0 | grep Enable | grep -q true || echo "not enabled ..."
> 
I started coding this, but I don't think that I like it. This is the DCB
check, not app:0, but it's the syntax we're talking about. I end up
with-

dcbtool gc ${IFNAME} dcb | grep 'DCB State' | grep -q on ||
( echo "DCB is not on, exectue the following command to turn it on" >&2
&&
    echo "dcbtool sc ${IFNAME} dcb on" >&2 &&
    failure=1 )

(the line wrap is making this look a bit funky, the "&&" on line #3
should really be at the end of line #2)

I don't think the shortcut use makes it any more readable since I really
want to do 3 things on the failure of my dcbtool output greppping.






More information about the devel mailing list