ref: 27a63ae22975171efbee5549d100f416ccb4066a
dir: /rc/bin/ape/ls/
#!/bin/rc # flags common to GNU and BSD ls # -A all except . and .. # -C force mc # -F usual # -H follow symlinks # -L follow symlinks # -R recursive list # -U unsorted (gnu) # # -a include .files # -c show ctime # -d dirs # -f no sorting # -l long # -p put slash after dir (-F) # -r reverse # -s sizes # -t time sort # -u utime # -1 single-column flagfmt='A,C,F,H,L,R,U,a,c,d,f,l,p,r,s,t,u,1' args='[file ...]' if(! ifs=() eval `{aux/getflags $*}){ aux/usage exit usage } fn fixlong { echo total 1000 /$cputype/bin/sed 's/^(.).(.........) . [0-9]+ /\1\2 1 /' } post=cat all=() # ignore -A if(~ $flagC 1) post=mc if(~ $flagF 1) all=($all -F) # ignore -H, -L # save -R for later if(~ $flagU 1) all=($all -n) # ignore -a, -c if(~ $flagd 1) all=($all -d) if(~ $flagf 1) all=($all -n) if(~ $flagl 1) { all=($all -l); post=fixlong } if(~ $flagp 1) all=($all -F) if(~ $flagr 1) all=($all -r) if(~ $flags 1) all=($all -s) if(~ $flagt 1) all=($all -t) if(~ $flagu 1) all=($all -u) # ignore -1 /$cputype/bin/ls $all $* | $post