Apologies for the very basic question.
I am trying to do something for a given absolute path and all its parent folders up to /. For the sake of the example here we'll just echo the path (I know that a solution to echoing the paths has been posted here, but please bear with me).
The following does not work. Moreover, after running that, ls and dirname are not found.
leo# cd /mnt/data/
leo# dirname /mnt/data
/mnt
leo# echo "Enter absolute path"; read path; until [[ "$path" == "$(dirname "$path")" ]]; do echo $path; path="$(dirname "$path")"; done
Enter absolute path
/mnt/data/
zsh: command not found: dirname
/ifs/data/
zsh: command not found: dirname
zsh: command not found: dirname
leo# ls
zsh: command not found: ls
leo# dirname
zsh: command not found: dirname
leo# echo ah
ah
leo#