How can I append items to a csh list?
14,424
You can just use the form of set my_list = ( $my_list more )
. For example:
# Create original list
% set my_list = ( hello world )
% echo $my_list
hello world
# Append to the list
% set my_list = ( $my_list hey there )
% echo $my_list
hello world hey there
# Loop over the list to verify it does what we expect it to do
% foreach item ($my_list)
foreach? echo "-> $item"
foreach? end
-> hello
-> world
-> hey
-> there
Author by
user1941008
Updated on June 24, 2022Comments
-
user1941008 about 2 years
I would like to create a list that will contain strings that apply to certain conditions in csh.
How do I add to a list or array in a dynamic way without pre determining the size of the list or the array ?
Is there is list.add or some such in the c shell ?
Thanks