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

296
Views
¿Qué sucede si el intérprete especificó después de #! ¿no está disponible?

¿Qué sucede si el intérprete especificó después de #! ¿no está disponible?

Sé que después del shebang tengo que especificar el intérprete (la mejor práctica es /bin/bash ). Como principiante, no me atrevo a probar mucho, tengo miedo de dañar mi sistema.

¿Podría darme ejemplos de capturas de pantalla de los dos escenarios?

  • el interprete existe
  • el intérprete no está disponible

Yo solo quiero entender.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

intente mucho Tengo miedo de dañar mi sistema.

No te preocupes, es seguro aquí. Los programadores cometen errores tipográficos todo el tiempo.

el interprete existe

Por ejemplo, un archivo llamado thefile contiene lo siguiente:

 #!/bin/cat blabla

Luego, cuando el archivo tiene establecido el bit de permiso ejecutable , ejecutar el archivo en sí mismo ejecutará el programa /bin/cat con un argumento ./thefile , como si escribiera /bin/cat ./thefile en su shell. El programa cat solo imprime el contenido del archivo, por lo que al ejecutar ./thefile ejecutará /bin/cat ./thefile con imprimirá el contenido del archivo en la pantalla.

 $ ./thefile #!/bin/cat blabla

el intérprete no está disponible

¿Qué sucede si el intérprete especificó después de #! ¿no está disponible?

Si su shell interpreta el shebang, se esperaría que su shell imprima algún tipo de mensaje de información de que no puede encontrar el intérprete, con una descripción de error de que "este archivo no existe" o similar . Si el archivo se ejecuta a través de una de las llamadas al sistema exec*() , entonces el kernel regresará con el código de error ENOEXEC (según el código fuente aquí )

Tomemos un archivo llamado anotherfile con el siguiente contenido:

 #!fdsafdsafafdasfdas blabla

Por ejemplo, Bash shell intentará analizar #! línea por sí misma. El shell interactivo de Bash imprimiría:

 $ ./anotherfile bash: ./anotherfile: fdsafdsafafdasfdas: bad interpreter: No such file or directory

Pero, por ejemplo, el shell Ash de Busybox presenta un mensaje diferente :

 $ ./anotherfile /bin/sh: ./anotherfile: not found

También https://en.wikipedia.org/wiki/Shebang_(Unix) podría ser interesante.

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!