Currently I have this two commands separeted by ;
:
ID=$(wmctrl -d | grep "\* DG"); kdialog --msgbox "D = ${ID:(-1)}"
Is there away to circumvent the creation of the auxiliary variable ID
but still use substring indexing (here used with negative index to count from behind)?
I am looking for some replacement for XXX
in "D = ${XXX:(-1)}"
. My current attempts all lead to "bad substitution" error.
Note: The original command (below) had some flaws to which some of the comments refer:
export ID=$(wmctrl -d | egrep "\* DG"); kdialog --msgbox "D = ${ID:(-1)}"