Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Comandos terminados con el mismo carácter

¿Cómo puedo arreglar la siguiente línea:

 for line in $(cat /root/files_to_search); do find /opt/ -iname $line -exec rm {} >> files_founded.txt ; done

El problema es que los comandos for y -exec terminan en punto y coma, el comando for tiene esta sentencia

 for i in something; do command ; done (do terminate with ;)

y find la declaración con -exec

 find /path/ -name somestring -exec command \; (-exec also finish with ;)
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Ni siquiera necesita usar -exec echo {} ya que esa es la acción predeterminada en find . Puedes usar esto para bucle:

 while IFS= read -r line; do find /opt/ -iname "$line" done < /root/files_to_search >> files_founded.txt

No es necesario usar for line in $(cat ...) ya que puede leer desde la entrada usando < file

Consulte las preguntas frecuentes de BASH sobre la lectura de un archivo línea por línea

Si debe usar -exec en find , use:

 while IFS= read -r line; do find /opt/ -iname "$line" -exec rm {} \; done < /root/files_to_search >> files_founded.txt
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!