-exec not working in find #95

Closed
torifat opened this Issue Jun 10, 2012 · 3 comments

Projects

None yet

3 participants

@torifat
torifat commented Jun 10, 2012

I tried to use-
find . -type f -name "*.mp3" -exec mv {} . /;

But, it is saying that mv can not find the file.

I switched to bash and it worked there.

Although, this is working just fine-
find . -type f -name "*.mp3"

I also tried to do the following but with no luck-
find /full/path -type f -name "*.mp3" -exec mv {} . /;

@ridiculousfish
Member

It's not exec, it's the {}. fish expands empty braces, bash does not.

If you quote it '{}', it should work as you expect.

I'll leave this open to consider matching bash's behavior here. It's not clear to me that expanding empty braces is desirable.

@torifat
torifat commented Jun 10, 2012

Thanks 😄

@torifat torifat closed this Jun 10, 2012
@hrldcpr
hrldcpr commented Nov 11, 2013

@torifat did you decide that expanding empty curly braces was worth keeping?
Having fish shell not work "out of the box" with basically all find -exec commands seems problematic—it almost forced me to switch shells until I found your '{}' workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment