I'm trying to take a full path directory and extract the every path out of it. For example
fullpath="/home/me/something/file"
/home/me/something/file
/home/me/something
/home/me
/home
My attempt but I haven't been able to figure out how to bring the paths out.
IFS=$'/'
                for i in $restorepath
                do
                     echo $i
                      if [ -d $i ]; then
                        echo dir exists
                       fi
                done
                unset IFS