In bash
echo ${!X*}
will print all the names of the variables whose name starts with 'X'. Is it possible to get the same with an arbitrary pattern, e.g. get all the names of the variables whose name contains an 'X' in any position?
Use the builtin command compgen:
compgen -A variable | grep X
1.4m articles
1.4m replys
5 comments
57.0k users