Home | History | Annotate | Download | only in hiddenapi
      1 #!/bin/bash
      2 set -e
      3 if [ -z "$1" ]; then
      4   source_list=/dev/stdin
      5   dest_list=/dev/stdout
      6 else
      7   source_list="$1"
      8   dest_list="$1"
      9 fi
     10 # Load the file
     11 readarray A < "$source_list"
     12 # Sort
     13 IFS=$'\n'
     14 A=( $(LC_COLLATE=C sort -f <<< "${A[*]}") )
     15 A=( $(uniq <<< "${A[*]}") )
     16 unset IFS
     17 # Dump array back into the file
     18 printf '%s\n' "${A[@]}" > "$dest_list"
     19