${(t)…}: Type of parameter

t evaluates to a string describing the type of the parameter. Additional properties are separated by -.

The first keyword describes the type:

  • scalar
  • array
  • integer
  • float
  • association

The following keywords describe additional properties of the parameter. Please refer to the manual for a complete list of possible values.

Examples

Print types of parameters
1
2
3
4
5
6
7
string=value
declare -i int=42
declare -F float_value=42.0
declare -Argxu many=([10]=ten [42]="fourty two")
echo ${(t)int}
echo ${(t)float_value}
echo ${(t)many}
Output:
1
2
3
integer
float
association-upper-readonly-export
BashSupport Pro is a Zsh IDE with support for ${(t)…}try it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal