I have a script that would have multiple paths (folder names).
Each folder path would have a Dockerfile, but its uncertain at what level that file would exist.
Lets say my path is "v1/airflow/1.86/src/code/"
Bu the file can be at Like for eg "v1/airflow/1.86/src/Dockerfile" or it can be at "v1/airflow/1.86/Dockerfile"
so i am trying to figure out a way where i can take a step back or cd ../ check recursively if the file exist there, if not then go one directory back, and look again and if it does, stop looking further
Any help is appreciated
basename&dirname? – Bib Feb 06 '23 at 18:30v1/airflow/1.86/src/code/is a relative path. Should the search forDockerfilestop after checkingv1/Dockerfile? or after./Dockerfile? Or should it continue up to/Dockerfile? (2) What if the path wasfoo/../bar/? Shouldfoo/Dockerfilebe ever considered? If by "my path" you meant your current working directory then..should not appear; butv1/airflow/1.86/src/code/is relative to your current directory, it cannot be your current working directory, I guess..may appear. (3) What if there are symlinks in the path? (compare this). – Kamil Maciorowski Feb 08 '23 at 17:28