#!/bin/bash
dir="";
for (( i=1; i<=6; i++ ))
do
if [ -e ${dir}$1 ]
then
echo "${dir}$1"
exit
fi
dir="../$dir"
done