Excerpts from Felipe Salvador's message of 2018-03-29 20:12:21 +0200:
> Hi list,
> I'm trying to make bash to expand a brace expansion in a if statement.
>
> So, I've
>
> if [ "$GTTY" = tty{0..10} ]; then
> msger=echo
> else
> msger=notify-send
> fi
>
> where $GTTY is $(tty | cut -d'/' -f3).
> It doesn't work.
> I'm reading allot of web pages, but I cannot get over.
> Could you please help me?
>
> Kind regards
That won't work. tty{0..10} . You want a OR operation to all
= tty{0..10}
you can write:
echo tty{0..10} | while read term; do
if [ "$GTTY" == "$term" ]; then
msger=echo
break
done
msger="${msger:-notify-send}
for same behaviour.
--
Marco Arthur @ https://optdyn.com