You must have a very old version of tcsh, that Word too long limit was removed in tcsh version 6.14.03 in 2006.
echo "$array"
Would pass the concatenation of the array elements to echo
as one element but fail if any contain a newline character.
echo "$array:q"
would be more correct to pass the concatenation of all elements.
To pass all the elements of the array (except the empty ones; though that will be fixed in the next release) as separate arguments to echo
, that would be:
echo $array:q
But if echo "$array"
fails for you with Word too long, echo
in that very old version may also fail with echo: Too many arguments..