Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个数组,我需要验证每个元素中的数据是“LOST”还是“FOUND”并且全部大写。换句话说,我需要验证数据是否等于丢失的单词或找到的单词,并且该单词是大写的。我需要在 ksh 中执行此操作。注意,我不需要从低到高转换。如果数据是小写的,我会发送通知。
谢谢。
对于 ksh93,这样的东西会起作用。
$ array=( LoST FOUND FOUND LOST ) $ for key in ${!array[@]}; do [[ ${array[key]} == +(LOST|FOUND) ]] && continue print -u2 "${array[key]} at key $key" done LoST at key 0 $