我想创建一个包含适用于某些字符串的列表 csh 中的条件。
如何在不预先确定的情况下以动态方式添加到列表或数组 列表或数组的大小?
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
关于list - 如何将项目附加到 csh 列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28584817/