Reference for Bash File Test Operators

just a useful table for file related IFs in Bash

Pavol Kutaj
Feb 10, 2023

The aim of this page📝 is to reference bash file test operators used in tests such as

if [[ -e $file ]]
then
echo "File exists."
fi

The source of this is Advanced Bash-Scripting Guide > File test operators, I’m reformatting into a table.

On Block VS Character devices

A block device reads and/or writes data in chunks, or blocks, in contrast to a character device, which acesses data in character units. Examples of block devices are hard drives, CDROM drives, and flash drives. Examples of character devices are keyboards, modems, sound cards.

--

--

No responses yet