Tuesday, 29 January 2019

[Gnu tools] find quirks

Intended effect

List all directories recursively called "ready" or "data" .

Failing command

find . -type d -a \(-name ready -o -name data\)
find: paths must precede expression: `(-name' 

Cause

find is somewhat picky with respect to parenthesis. It is not enough to escape them.

Solution

Make sure, whitespace is around them.
find . -type d -a \( -name ready -o -name data \)

No comments:

Post a Comment

[git] Create a local branch from another branch

From the active branch git checkout -b <LOCAL_BRANCH> From a donator branch git checkout -b <LOCAL_BRANCH> <DONATING_BRANCH...