I have an Awk script that behaves correctly from a command prompt but differently in a Makefile
the script is:
pwd | awk 'BEGIN {FS="/"}{print NF} {print $NF}'
from the command prompt, NF gives the field count and $NF correctly gives the last field.
from the makefile, NF gives the correct field count, but $NF
prints the entire path as one field.
the script is:
pwd | awk 'BEGIN {FS="/"}{print NF} {print $NF}'
from the command prompt, NF gives the field count and $NF correctly gives the last field.
from the makefile, NF gives the correct field count, but $NF
prints the entire path as one field.