i want to reduce the OPTIONS variable which is a list of email addresses to just the unique entries. The following works, but, i would like to accomplish it without using the temporary file (dest.txt)
$echo $OPTIONS
a b c A B D
$cat clean
#!/usr/bin/bash
n=$#
i=1
cat /dev/null >/usr/spool/lp/temp/dest.txt
while [ $i -le $n ]
do
c=$(echo $1 |tr "[:upper:]" "[:lower:]" )
echo $c>>/usr/spool/lp/temp/dest.txt
shift
let i=$i+1
done
sort -u </usr/spool/lp/temp/dest.txt
$ OPTIONS1=$(./clean $OPTIONS)
$ echo $OPTIONS1
a b c d
$
without worrying about having a shell that supports the case modification parameter expansion or the shuf utility which are both extensions to the standards.