What I want is if I enter any number with space delimited, it will sort it in ascending order. I have this in my bash created file.
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "error: Not a number" >&2; exit 1
else
printf "%s\n" $@ | sort -n
fi
Basically what id does above is if the user enter a non numeric it will display an error else will sort the numbers.
So if I enter in command: $: sh sort.sh 12 0 13. This will order it out to
0
12
13
Now my problem is I don't want it in a new line, instead I want it in a space.