home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- # Usage:
- # print_file_names [ -d dir ] file_or_dir [ file_or_dir ... ]
- #
- # Prints out each of the file names given by its argument. If the
- # file turns out to be a directory, the contents of that directory
- # are printed. The -d flag says "print the file names relative to <dir>"
- # instead of relative to the current directory. Symbolic links
- # are suppressed.
-
-
- if [ "$1" = "-d" ]
- then
-
- cd $2
- shift 2
- fi
-
-
- for file
- do
- if [ ! -h ${file} ]
- then # suppress symbolic links
- echo ${file}
- if [ -d ${file} ]
- then # recurse
- print_file_names `/bin/ls -d ${file}/*`
- fi
- fi
- done
-
-
-