Como ordenar Matriz Inteira em ksh. Script de shell Unix
Como classificar uma matriz inteira no KornShell. Encontrei este link,Matriz de números inteiros KornShell mas parece não estar funcionando e gerando erro.
Código:
NUM_ARR[1]=-1
NUM_ARR[2]=-2
NUM_ARR[3]=-3
NUM_ARR[4]=-4
NUM_ARR[5]=-5
NUM_ARR[6]=-6
NUM_ARR[7]=-7
for file in /home/fimsctl/datafiles/outbound/timelog/timelog_file_*.csv ; do
SORTED_NUM_ARR=`($(printf "%s\n" ${NUM_ARR[@]} | sort -n))`
echo ${SORTED_NUM_ARR[*]}
done
Resultado:
testb.ksh[118]: -7: not found