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

139
Vistas
Using jq to extract information about dependencies from package.json

So I am trying to run a jq command inside a makefile to link some dependencies, and I do not understand what the line inside the do-done does. If using only echo "$$dep" I understand what's going on, but when using the full line of code ([ -f "$$dep/package.json" ] && echo "$$dep";) I seem to be lost. Does anyone have any idea? Thanks.

jq -r '.dependencies,.devDependencies|keys[]' $< | while read -r dep; do \
    [ -f "$$dep/package.json" ] && echo "$$dep"; \
done | (piping forward)
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Since this is in a makefile, there are two things that need to be understood. First, to understand the "$$" variable ($$dep), see this stackoverflow question:

Makefile and use of $$

Second, to understand the ... in do ... done, remember that this is essentially equivalent to a shell conditional of the form:

if [ -f _ ] ; then echo _ ; fi

For details about the test, see e.g. http://wiki.bash-hackers.org/commands/classictest

over 4 years ago · Santiago Trujillo Denunciar
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