I wrote a simple script for generating aliases in zsh shell. Here it is:
for subject in $(find $path -maxdepth 2 -type d -print)
do
dir=$(printf -- "$subject\n" | sed 's|.*/||')
alias "$dir"="cd $subject"
done
It is pretty self-explanatory - recurses through a directory to up to 2 levels, and lists every directory found. Later, it uses that directory name as an alias for changing directory.
Somewhat predictably, it doesn't work. Aliases remain "encapsulated" within the script. For the record, when I execute these script lines in shell, everything works fine.
Thanks in advance.