I'm wondering if there's some command that takes in a variable as an argument, and echoes all of its attributes (integer, array, readonly, etc)
2 Answers
Use ${variable@a}. For example:
$ declare -ai X=(1 2 3)
$ echo ${X@a}
ai
Thanks to user "F. Hauri - Give Up GitHub"; I found that notation in their answer to this unrelated question: Unset readonly variable in bash
Here is how to get the flags for variable if you have its name in another variable.
$ S="X"
$ echo ${!S@a}
ai
lsattrandstat, or extended versions offindcapable of metadata lookup -- aren't part of bash, but are provided by your operating system, so they'd need to be asked with a different set of tags).