std.c: Improve some comments
[sunny256-utils.git] / slfind
blob3f30934d84c3a0d9b7e47933e637a65b2a24694a
1 #!/bin/sh
3 #==============================================================================
4 # slfind
5 # File ID: 87677550-dbda-11ed-84e1-897d95857ba2
7 # Same behavior as find(1), but add a terminating slash to directories and sort
8 # the output.
10 # Author: Øyvind A. Holm <sunny@sunbase.org>
11 # License: GNU General Public License version 2 or later.
12 #==============================================================================
14 progname=slfind
15 VERSION=0.1.0
17 opt_help=0
18 opt_quiet=0
19 opt_verbose=0
20 while test -n "$1"; do
21 case "$1" in
22 -h|--help) opt_help=1; shift ;;
23 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
24 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
25 --version) echo $progname $VERSION; exit 0 ;;
26 --) shift; break ;;
28 if printf '%s\n' "$1" | grep -q ^-; then
29 echo "$progname: $1: Unknown option" >&2
30 exit 1
31 else
32 break
34 break ;;
35 esac
36 done
37 opt_verbose=$(($opt_verbose - $opt_quiet))
39 if test "$opt_help" = "1"; then
40 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
41 cat <<END
43 Same behavior as find(1), but add a terminating slash to directories and
44 sort the output.
46 Usage: $progname [options] [PATH [...]]
48 Options:
50 -h, --help
51 Show this help.
52 -q, --quiet
53 Be more quiet. Can be repeated to increase silence.
54 -v, --verbose
55 Increase level of verbosity. Can be repeated.
56 --version
57 Print version information.
59 END
60 exit 0
63 find "$@" \( -type d -printf "%p/\n" , ! -type d -print \) | sort -u
65 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :