Shell script to get nested and parent path from files

I’ve been searching how to get the current path from file in shell script, but in addition I want to know which is the path of the import in the shell script.

In the next example I would like to share how to get that, my folder have this structure:

.
├── nested
│   └── child.sh
└── parent.sh

The scripts are explained by self: Seguir leyendo