#!/bin/bash

if [ -d '$1' ]; then echo '$1 is a directory.' elif [ -f '$1' ]; then echo '$1 is a file.' else echo '$1 is not a valid file or directory.' fi

这个脚本接受一个参数,可以是文件或目录的路径

如果参数是目录,输出“xxx is a directory.”

如果参数是文件,输出“xxx is a file.”

如果参数不是有效的文件或目录,输出“xxx is not a valid file or directory.”


原文地址: https://www.cveoy.top/t/topic/ojem 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录