用于通配符字符串的外壳过滤器数组

时间:2019-09-04 06:28:44

标签: arrays bash shell filtering

我一般是Shell脚本的新手。我将需要为通配符字符串UCD*(*为通配符)过滤数组,并从数组alarmIDs中删除 all 所有这些元素。

#remove first element from array
alarmIDs=("${alarmIDs[@]:1}")
#now exlcude all strings starting with "UCD"

在shell脚本中这样做并保持原始数组名称alarmIDs(不创建新数组)的最佳方法是什么?

0 个答案:

没有答案