Talvez tente algo assim, embora eu não tenha certeza do que seu script está fazendo.
if [ -n "$1" -a -n "$2" -a -f "$1" ]; then
dts=($(cat $1 | cut -d: -f$2))
for i in ${!dts[@]}; do
echo "$i) ${dts[$i]} "
done
read -p "Select a user to delete: " OKSELUSRGRP
p=$(echo $OKSELUSRGRP | grep -E ^[0-${#dts[@]}]$)
while [ -z "$p" ]; do
echo "Error, select a correct option"
sleep 1
read -p "Select a user to delete: " OKSELUSRGRP
p=$(echo $OKSELUSRGRP | grep -E ^[0-${#dts[@]}]$)
done
OKSELUSRGRP=${dts[$p]}
else
echo "
Usage: $0 [file] [something else]
$0 can be used to select users or something.
"
fi