第4个
#!/bin/bash
if [ -f "$1" ]; then
echo "This is a regular file"
else
echo "This is not a regular file"
fi
第5个
#!/bin/bash
if [ $# -lt 1 ]; then
exit 1
fi
if [ -d "$1" ]; then
echo "$1 is a directory"
elif [ -f "$1" ]; then
echo "$1 is a regular file"
else
echo "$1 doesn't exist."
fi