I have an if statement in a bash file:
if [ -f bin/post_compile ]; then
echo "-----> Running post-compile hook"
chmod +x bin/post_compile
sub-env bin/post_compile
fi
what does the -f
mean?
If the file exists and is a regular file.
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
your statement in English:
If the file "/bin/post_compile" exists and is a regular file then:
sub-env
end if (fi
)
help test | grep -- -f
[something]
is equivalent totest something
. As @Cyrus says, lookuptest
, by typinghelp test
.