filetype2.sh

来自「Solaris环境下Shell编程编程」· Shell 代码 · 共 44 行

SH
44
字号
#!/bin/sh# Purpose: This script will determine whether the pathnames passed #          on the command line are a file or directory. Then it will#          print information about the pathname.## Scriptname: filetype2.shif [ $# -eq 0 ]; then	echo "Usage: filetype2.sh pathname [pathname2...]"	exit 1fiwhile [ $# -ne 0 ] do	if [ -d $1 ]; then	        echo "$1 is a directory."	        echo "Following is a listing of the $1 directory."	        ls $1	        echo " "	        echo "The number of kilobytes used by directory $1 is: \c"	        du -s -k $1 | nawk '{print $1}'	else	        echo "$1 is a file."	        echo "The size of $1 in bytes is: \c"	        ls -l $1 | nawk '{print $5}'	        echo	        if [ -b $1 ]; then	                echo "$1 is s block special file."	        elif  [ -c $1 ]; then	                echo "$1 is s character special file."	        elif  [ -u $1 ]; then	                echo "$1 has the set-user-id permission."	        else	                echo "There is nothing special to say about file $1."	        fi	fi	shift	echo "\n\n"doneecho "Finished"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?