In order for each line of output to sortbe placed in its own element of the array, IFSit is necessary to install in a new line. To output an array, you need to iterate over it.
#!/bin/bash
for file in $1; do
if [[ ! $file = *.user ]]; then
continue
fi
saveIFS=$IFS
IFS=$'\n'
arr=($(sort -nrk4 "$file"))
IFS=$saveIFS
for i in "${arr[@]}"
do
echo "$i"
done
done
, reset IFS, , , , IFS , * :
echo "${arr[*]}"
, .
ls for. $1 globbing, . , , . , $1 , .
, , .
$(). .
, , , . , @ .