#!/bin/bash
for file in $@
do
Inode=$(stat $file | grep -- 'Inode:' | sed -e's/.*Inode: \([0-9]*\).*/\1/')
Links=$(stat $file | grep -- 'Links:' | sed -e's/.*Links: \([0-9]*\).*/\1/')
if test $Links -ge 2
then
find -inum $Inode | xargs shred -u -n 30 -z
else
stat $file | grep -- 'File:' | sed -e's/[^‘]*‘\([^ ]*\)’[^‘]*/\1 /g' | xargs shred -u -n 30 -z
fi
done