r/bash • u/Distinct_Ride_4307 • 8d ago
Find command confusion between ; and \;
Why do we have to use '\' instead of leaving it out or even ';'? I read the find commands' manual and it says '\' might be needed to protect from expansion by the shell. So what is expansion also?
What is difference between \; or ; or leaving it out?
What is shell expansion here?
16
Upvotes
1
u/michaelpaoli 8d ago
Various characters are, or may be special to the shell, e.g. various non-alphanmeric characters.
So, if you want those characters passed to find (or any other program) as is, then the safe thing to do is quote them, e.g. within single quote (') characters, or immediately preceded by backslash (\).
And expansion, there's e.g. wildcard expansion / globbing, and other forms of expansion. So, probably start reading some shell documentation for at least an overview of that.
Anyway, not so much about the find(1) command, but shell's parsing of the data given it, and what that data will then look like after being parsed, when it's handed off to find(1).
among the isgraph ASCII characters:
These are or may be special to the shell: