#! /bin/bash
# filename:FileType.sh
read -p "Please input the filename :" filename
fpath=$filename
if [ -d $fpath ]
then
echo "谈渗枯$fpath is a direstory."
elif [ -e $fpath ]
then
echo "喊宴$fpath is a file."
else
echo "$fpath is NOT a file or direstory."
fi
# 目录兄枣存羡孝拆在Test-Path $path -PathType Container
[System.IO.Directory]::Exists($path)
# 文件存在慎裂
Test-Path $path -PathType Leaf
[system.IO.File]::Exists($path)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)