What is $'\0' in bash?

Viewed 50

What does this $'\0' mean in the -d option for the read command?

I understand it is being used as a delimiter for the read command, but I'm lost with the syntax used.

find path/to -type f -print0 | while read -d $'\0' file; do
        grep "Willy" "$file"
done
1 Answers

Turns out it is a nice trick to use find and read together to search through several files.

The $'\0' is the null character, and if the find command is used with the -print0 option, its results will be separated by the null character.

It is well explained here.

Related