#!/bin/bash
#Hmm noticed that ls V 4.01 has a -Sr option that does the same
#as this (directories are listed though). It's kinda bad actually
#since ls should just be listing files and other utils should
#sort and format etc. Hmm.. Also ls still groups files in each directory
#and doesn't group files together.
#
#following command not 100% correct as need ls on end of pipe to
#do --color=auto, hardcoding --color below will cause problems
#if need to pipe this elsewhere.
#	ls --color -l -U -A ${*-.} | grep -e "^d" -v | sort +4n
#Note instead of doing `-type f -or -type l` in the find command
#below you could have done:
#{
# find ${*-.} -type l -maxdepth 1 -printf "%s $findPathFormat\n"
# find ${*-.} -type f -maxdepth 1 -printf "%s $findPathFormat\n"
#} |
#This obviously more inefficient in this case but the construct
#could be very useful in certain situations.
#Note I'm checking for symbolic links also as these are "real files"
#and so have space allocated. (Note on ext2 if they're less than 60 bytes
#they don't use space. Reiser does this for all (parts of) files less
#than 1 block).

set -f
. getfpf $@

find $findArgs \( -type l -or -type f \) -maxdepth 1 \
     -printf "%s $FPF\n" |
sort -k1,1n |
#remove sizes (only first space encountered is removed as required)
cut -s -d" " -f2- - |
tr '\n' '\0' |
xargs -r0 ls -lU --color=auto --

