方法1: if grep -qs '/mnt/foo' /proc/mounts; then echo "It's mounted." else echo "It's not mounted." fi 方法2: if mountpoint -q /mnt/foo then echo "mounted" else echo "not mounted" fi
做数据库备份作业的时候..想按日期建立文件夹.. 首先要判断文件夹是否存在 ) --路径 ) --日期 例如: 20171011 SET @DATE=CAST(DATEPART(YYYY,GETDATE()) AS VARCHAR)+CAST(DATEPART(MM,GETDATE()) AS VARCHAR)+CAST(DATEPART(DD,GETDATE()) AS VARCHAR) SET @PATH = 'E:\SQL2012_BAK\'+@DATE+'\' DECLARE @TEMP