0

I am facing an issue on this command line

sh.exec('find site/docs/4.1/examples/ -mindepth 1 -maxdepth 1 -type d -name "rtl-*" - 
exec bash -c \'rm -rf site/docs/4.1/examples/$(basename "{}")/*\; rmdir 
site/docs/4.1/examples/$(basename "{}")\' ;',(code))

which raises a find: missing argument to `-exec'

I am troubleshooting it with everything I found on the internet but none of the fix found help me. do you have an idea why it's not working ?

Lio MC
  • 31
  • 7
  • I believe it should be `-exec bash -c ...`, not `exec bash -c ...`. Also see [How to use Shellcheck](https://github.com/koalaman/shellcheck), [How to debug a bash script?](https://unix.stackexchange.com/q/155551/56041) (U&L.SE), [How to debug a bash script?](https://stackoverflow.com/q/951336/608639) (SO), [How to debug bash script?](https://askubuntu.com/q/21136) (AskU), [Debugging Bash scripts](http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html), etc. – jww Jul 18 '18 at 15:45
  • Thank you jww. But it's no working for me :/ – Lio MC Jul 18 '18 at 15:56
  • Hello ! I solved it by adding a double backslash before the last semicolon of the command line. `sh.exec('find site/docs/4.1/examples/ -mindepth 1 -maxdepth 1 -type d -name \'rtl-*\' -exec bash -c \'rm -rf site/docs/4.1/examples/$(basename "{}")/* ; rmdir site/docs/4.1/examples/$(basename "{}")\'\\ ;' ` – Lio MC Jul 20 '18 at 07:21

0 Answers0