LDP/LDP/guide/docbook/abs-guide/file-info.sh

31 lines
683 B
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
# fileinfo.sh
2005-02-09 20:53:43 +00:00
FILES="/usr/sbin/accept
2001-07-10 14:25:50 +00:00
/usr/sbin/pwck
2005-02-09 20:53:43 +00:00
/usr/sbin/chroot
2001-07-10 14:25:50 +00:00
/usr/bin/fakefile
2005-02-09 20:53:43 +00:00
/sbin/badblocks
2001-07-10 14:25:50 +00:00
/sbin/ypbind" # List of files you are curious about.
2001-09-04 13:27:31 +00:00
# Threw in a dummy file, /usr/bin/fakefile.
2001-07-10 14:25:50 +00:00
echo
for file in $FILES
do
2001-09-04 13:27:31 +00:00
if [ ! -e "$file" ] # Check if file exists.
2001-07-10 14:25:50 +00:00
then
echo "$file does not exist."; echo
2001-09-04 13:27:31 +00:00
continue # On to next.
2001-07-10 14:25:50 +00:00
fi
2009-09-29 15:08:03 +00:00
ls -l $file | awk '{ print $8 " file size: " $5 }' # Print 2 fields.
2001-07-10 14:25:50 +00:00
whatis `basename $file` # File info.
2005-02-09 20:53:43 +00:00
# Note that the whatis database needs to have been set up for this to work.
# To do this, as root run /usr/bin/makewhatis.
2001-07-10 14:25:50 +00:00
echo
done
exit 0