#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/lib/ksh93/util/list/KLIB_UTIL_LIST_unique_key_list.sh 1.4 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2005,2011 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)11 1.4 src/43haes/lib/ksh93/util/list/KLIB_UTIL_LIST_unique_key_list.sh, hacmp, 61haes_r714 11/28/11 15:12:31 # #=head1 NAME # # KLIB_UTIL_LIST_unique_key_list - Remove duplicates from a list # #=head1 SYNOPSIS # # typeset list="a b d e f b a a b" # KLIB_UTIL_LIST_unique_key_list list # echo $list # #=head1 DESCRIPTION # # Removes duplicate entries from a list # #=head1 ARGUMENTS # # 1: [by ref] list of elements to remove duplicates from # #=head1 RETURN # # None # #=head1 COPYRIGHT # #(C) COPYRIGHT International Business Machines Corp. 2005 #All Rights Reserved # #=cut # function KLIB_UTIL_LIST_unique_key_list { . /usr/es/lib/ksh93/func_include typeset -n list=$1 typeset -A array while shift; (( $# )); do array[${1}]=: done list="${!array[*]}" }