Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Missing argument to exec

📅 2016-Mar-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, find, fish ⬩ 📚 Archive

Problem

I run a find command at the Fish shell and get this error:

$ find . -type f -exec sed -i 's/foo/bar/g' {} +
find: missing argument to `-exec`

Solution

This command has nothing wrong with it, it works under Bash. Fish expands the curly braces by default. So, for this to work, just enclose the curly braces in single quotes, so that it is not expanded. More details here.

Tried with: Fish 2.2.0 and Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧