RituV
RituV

Reputation: 63

What does -f in an if conditional mean in shell script?

tmpFilename="buildDefTemp.txt"

if [ -f $tmpFilename ]; then
    rm -f $tmpFilename
fi
if [ -f $buildDefinitionFile ]; then
    rm -f $buildDefinitionFile
fi

Upvotes: 1

Views: 5450

Answers (1)

magni-
magni-

Reputation: 2055

http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

[ -f FILE ] True if FILE exists and is a regular file.

Upvotes: 3

Related Questions