I have a bash script called my-script.sh
inside a folder 2 level up from the root where I want this script to be called/executed from
/folder1
/folder2/
- my-script.sh
- do-it.sh
my-script.sh
#!/bin/bash
./do-it.sh
If I execute my-script.sh
from the root folder it fails since it tries to find do-it.sh
in the same folder.
folder1/folder2/my-script.sh: line 3: ./do-it.sh: No such file or directory
If I want to execute my-script.sh script properly I have to get into folder2 first and them execute it
cd /folder1/folder2
./my-script.sh
Is there a way to execute it from root folder as it was being executed from folder2?