% Remember to use the lgrind style

\Head{}
\File{dirsize.sh}{2003}{Apr}{16}{18:46}{563}
\L{\LB{\C{}\#!_\1bin\1sh}}
\CE{}\L{\LB{}}
\L{\LB{\C{}\#_Question_4,_shell_programming_assignment,_2003.}}
\CE{}\L{\LB{}}
\L{\LB{\V{prog}={`}\V{basename}_\N{\$0}{`}}}
\L{\LB{\V{usage}()_\{}}
\L{\LB{___\V{echo}_\S{}\3Usage:_\$prog_[\-s]_[\-l]_dir.\,.\,.\3\SE{}}}
\L{\LB{___\V{echo}_\S{}\3print_disk_usage_of_each_directory\3\SE{}}}
\L{\LB{___\V{echo}_\-\-_\S{}\3\-s_smallest_first\3\SE{}}}
\L{\LB{___\V{echo}_\-\-_\S{}\3\-l_largest_first\3\SE{}}}
\L{\LB{___\K{exit}_\N{1}}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\V{SORTBY}=\V{largest\_first}}}
\L{\LB{\K{while}_\V{getopts}_\S{}\3:sl\3\SE{}_\V{opt}}}
\L{\LB{\K{do}}}
\L{\LB{____\K{case}_\N{\$opt}_\K{in}}}
\L{\LB{________\V{s})_\V{SORTBY}=\V{smallest\_first}_;;}}
\L{\LB{________\V{l})_\V{SORTBY}=\V{largest\_first}__;;}}
\L{\LB{________\*)_\V{usage}_________________;;}}
\L{\LB{____\K{esac}}}
\L{\LB{\K{done}}}
\L{\LB{\K{shift}_\N{\$}((\V{OPTIND}_\-_\N{1}))}}
\L{\LB{}}
\L{\LB{\V{SORTOPT}=\-\V{r}}}
\L{\LB{\K{if}_[_\S{}\3\$SORTBY\3\SE{}_=_\S{}\3smallest\_first\3\SE{}_];_\K{then}}}
\L{\LB{____\V{SORTOPT}=}}
\L{\LB{\K{fi}}}
\L{\LB{}}
\L{\LB{\V{du}_\-\V{s}_\S{}\3\$@\3\SE{}_\|_\V{sort}_\-\V{n}_\N{\$}\{\V{SORTOPT}\}}}
