#!/bin/rc rfork e fn singulatim{ if(test $#* -gt 1){ echo This mode lists only one directory at a time. >[1=2] exit 'too many directories' } if(~ $#* 1 && ! test -e $1){ echo $1 does not exist! >[1=2] exit 'directory does not exist' } } switch($1){ case [1-9] [1-9][0-9] [1-9][0-9][0-9] # list n newest n = $1 shift walk -n1,1 -emp $* | sort -nr | sed $n^q | while(i = `{read}) echo `{date -f 'YYYY-MM-DD hh:mm' $i(1)} $i(2) case l # long listing shift singulatim $* fn fmt{ if(test -T $3) echo -n 't' if not echo -n ' ' echo $1 `{date -f 'YYYY-MM-DD hh:mm' $2} $3 $4 } if(~ $#* 1 && test -f $1){fmt `{walk -exmp $1}; exit} walk -n1,1 -d -exmp $1 | sort +2 | while(i = `{read}) fmt $i walk -n1,1 -f -exmps $1 | sort +2 | while(i = `{read}) fmt $i case r # recursive: dirs only shift walk -d $* | sort | sed 's,[^/]+/, ,g' case * # compact default singulatim $* fn fmt{ if(test -x $1) echo $1 | sed 's/$/*/' if not echo $1 } if(~ $#* 1 && test -f $1){fmt $1; exit} walk -n1,1 -d -en $1 | sort | sed 's,$,/,' | mc walk -n1,1 -f -en $1 | sort | {while(i = `{read}) fmt $i} | mc }