bash eval in if with piped command : <p>piped eval in bash for string length comparison</p>

<p>i am trying to check if a certain device with a given id is plugged in and trigger a action based on that </p>

<p>i tried eval / exec</p>

<p>here is what i have so far</p>

<pre><code>#!/bin/bash
KBP='[["lsusb -d 1c11:b04d | wc -c" == "0"]]'
if eval $KBP; then
    echo expression evaluated as true
else
    echo expression evaluated as false
fi
</code></pre>

<p>expected result:</p>

<p>if device is plugged in and string is not 0 it would hop in the false condition </p>

<p>actual result - cant evaluate the piped condition </p>
