Bash – What does -f mean in bash

bashoperators

I was looking at how to use runit to run gunicorn. I was looking at the bash file and I don't know what -f $PID does in

#!/bin/sh

GUNICORN=/usr/local/bin/gunicorn
ROOT=/path/to/project
PID=/var/run/gunicorn.pid

APP=main:application

if [ -f $PID ]; then rm $PID; fi

cd $ROOT
exec $GUNICORN -c $ROOT/gunicorn.conf.py --pid=$PID $APP

Google is useless in this case because searching for flags is useless

Best Solution

Google is useless in this case because searching for flags is useless

Fortunately, the Bash Reference Manual is available online, at http://www.gnu.org/software/bash/manual/bashref.html. It's the first hit when you Google for "Bash manual". §6.4 "Bash Conditional Expressions" says:

-f file

True if file exists and is a regular file.