You need to use the -p construct to see if the file is of type named pipe. It works with the standard test [ (POSIX compliant) and the extended test operators [[ ( bash/zsh specific )
if [[ -p "$fifo" ]]; then
printf '%s is a named pipe' "$fifo"
fi
From the man pages of bash
-p file
True if file exists and is a named pipe (FIFO).
or use the file command with the -b to just print the type information without the filename. The -b might not be POSIX compliant
if [ $(file -b "$fifo") = "fifo (named pipe)" ]; then
printf '%s is a named pipe' "$fifo"
fi
Without the -b, one could do
type=$(file "$fifo")
if [ "${type##*: }" = "fifo (named pipe)" ]; then