Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
How to get the path of a sourced Bourne shell script?

In Bash, the correct way to get the full path to a shell script is ${BASH_SOURCE[0]}, since $0 returns bash if the script is being sourced. For example, try running this in your terminal:

source <(echo 'echo $0')

It will print bash.

Does anyone know how to do this for Bourne shell scripts? For example, what would be the contents of a script foo such that if I typed this:

sh -c '. foo'

it would output the full path to the script?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda