سؤال

find . -name '.git' -exec printf %q "'{}'"  \; ;
printf: illegal format character q

It seems the problem is that the printf being called is not bashes builtin printf Is there any way to use builtin printf ?

هل كانت مفيدة؟

المحلول

Just call bash and give it an inline script to invoke printf:

 find . -name '*.txt' -exec bash -c "printf %q\\\\n {}" \;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top