我希望创建一个包含符合csh中某些条件的字符串的列表。
如何以动态方式向列表或数组添加内容,而不需要预先确定列表或数组的大小?
在c shell中是否有list.add或类似的函数?
谢谢。
如何以动态方式向列表或数组添加内容,而不需要预先确定列表或数组的大小?
在c shell中是否有list.add或类似的函数?
谢谢。
set my_list = ( $my_list more )
。例如:# 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