home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / computers / 3b2 / samedev < prev    next >
Text File  |  1985-07-02  |  567b  |  41 lines

  1. set -ue
  2.  
  3. IFS="${IFS},"
  4.  
  5. if [ $# -lt 2 ]
  6. then
  7.     echo "Usage: ${0} known_dev check_dev ..." >&2
  8.     exit 1
  9. fi
  10.  
  11. eval `ls -l ${1} | \
  12.     (read perm links uid gid major minor month day when name ; \
  13.     echo perm=${perm} want=${major}/${minor})`
  14.  
  15. shift
  16.  
  17. case "${perm}" in
  18. b*)
  19.     type=b
  20.     ;;
  21. c*)
  22.     type=c
  23.     ;;
  24. *)
  25.     echo "${0}: ${arg}: Not a block or character device" >&2
  26.     continue
  27.     ;;
  28. esac
  29.  
  30. ls -ld "$@" | while read perm links uid gid major minor month day when name
  31. do
  32.     case "${perm}" in
  33.     ${type}*)
  34.         if [ "${major}/${minor}" = "${want}" ]
  35.         then
  36.             echo "${name}"
  37.         fi
  38.         ;;
  39.     esac
  40. done
  41.