bash file exists
cat conditf
#!/bin/bash
FILE=$1
if [_-f $FILE_];
then
echo "File $FILE exists."
else
echo "File $FILE does not exist."
fi
./conditf sc
File sc does not exist.
./conditf sc3
File sc3 exists.
#
#!/bin/bash
FILE=$1
if [_-f $FILE_];
then
echo "File $FILE exists."
else
echo "File $FILE does not exist."
fi
./conditf sc
File sc does not exist.
./conditf sc3
File sc3 exists.
#
-f file
- True if file exists and is a regular file.
Comments
Post a Comment