#!/bin/sh

[ -z "$1" ] && cat <<-_EOF_ && exit 1
    Usage: ./$(basename $0) filename
_EOF_

FILE=$1

[ ! -f "$FILE" ] && echo "File $FILE not exists! Exiting..." && exit 1
if [ "$(ls -ld "$FILE" | awk '{print $2}')" -ne 1 ]; then
    find `df "$FILE" | tail -n+2 | awk '{print $6}'` -xdev -inum `ls -i "$FILE" | awk '{print $1}'`
else
    echo "File $FILE is got only 1(one) link on filesystem..."
    exit 1
fi

Ссылки по теме:

  1. How can you see the actual hard link by ls?

Comments

comments powered by Disqus