Removing duplicates on a variable without sorting

后端 未结 8 1021
陌清茗
陌清茗 2020-12-28 23:30

I have a variable that contains the following space separated entries.

variable=\"apple lemon papaya avocado lemon grapes papaya apple avocado mango banana\"         


        
8条回答
  •  被撕碎了的回忆
    2020-12-28 23:52

    Z Shell:

    % variable="apple lemon papaya avocado lemon grapes papaya apple avocado mango banana"
    % print ${(zu)variable}                                                               
    apple lemon papaya avocado grapes mango banana
    

提交回复
热议问题