Skip to main content

All Questions

Tagged with
4 votes
5 answers
227 views

Looking for a convenient way to create a "constant array"

In zsh, is there a convenient way to create an array of n copies of the same integer? Context: In a shell script, I need to create an array, tile_lengths, consisting of two longish constant blocks. A ...
kjo's user avatar
  • 16.2k
8 votes
3 answers
5k views

${#array} vs ${#array[@]}

As far as I can tell both ${#array[@]} and ${#array} evaluate to the number of elements in $array. Is there any reason for preferring the longer form (${#array[@]})?
kjo's user avatar
  • 16.2k