Chinaunix首页 | 论坛 | 博客
  • 博客访问: 35421
  • 博文数量: 15
  • 博客积分: 648
  • 博客等级: 上士
  • 技术积分: 155
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-13 00:01
文章分类

全部博文(15)

文章存档

2011年(6)

2010年(3)

2009年(6)

分类:

2009-07-19 21:35:47

#!/bin/bash
#this script gives information about a file
FILENAME="$1"
echo "Properties for $FILENAME:"
 if [ -f $FILENAME ];then
  echo "Size is $(ls -lh $FILENAME | awk '{print $5}')"
  echo "Type is $(file $FILENAME | cut -d":" -f2 -)" #或者echo "Type is $(file $FILENAME | awk 'BEGIN{FS=":"}{print $2}')"
  echo "Inode number is $(ls -i $FILENAME | cut -d" " -f1 -)" #或者echo "Inode number is $(ls -i $FILENAME | awk '{print $1}')"
  echo "$(df -h $FILENAME | grep -v Mounted | awk '{print "On",$1",\
which is mounted as the ",$6,"partition."}')"
 else
  echo "File does not exist."
fi
阅读(627) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~