then
echo "directory"
else
echo "not a directory"
fi 下春好面是全部参数,里面就有你需宏高要的:-a file exists.
-b file exists and is a block special file.
-c file exists and is a character special file.
-d file exists and is a directory.
-e file exists (just the same as -a).
-f file exists and is a regular file.
-g file exists and has its setgid(2) bit set.
-G file exists and has the same group ID as this process.
-k file exists and has its sticky bit set.
-L file exists and is a symbolic link.
-n string length is not zero.
-o Named option is set on.
-O file exists and is owned by the user ID of this process.
-p file exists and is a first in, first out (FIFO) special file or
named pipe.
-r file exists and is readable by the current process.
-s file exists and has a size greater than zero.
-S file exists and is a socket.
-t file descriptor number fildes is open and associated with a
terminal device.
-u file exists and has its setuid(2) bit set.
-w file exists and is writable by the current process.
-x file exists and is executable by the current process.
-z string length is zero.
dos格式和unix格式差别就在于换行符。只要把所有的换行符统一衫纤,就完成了转化,如
unix2dos 是转为dos格式
dos2unix 是转为unix格式
但是判断就不是绝对的了,因为有可能文件中漏陪既有dos换行符,也有unix换行符,因此是模糊的,并没有什么意义。
有使用返塌蠢用file 命令可以显示格式,但并不一定有效。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)