On 05/27/2018 11:08 PM,
waset2...@gmail.com wrote:
> Sometimes I cd to a directory (that is not in my $CDPATH) with an
> environmental variable pointing to a filename in that directory e.g.
Okay.
> What am I doing wrong?
I don't know what you're doing wrong per say. My guess would be that
the variable is expanded when the alias / function is set. There may be
a way to escape the variable so that it's expanded when said alias /
function is executed.
I would forgo the sub-shell with the dirname command. Bash and Zsh both
support removing suffixes (and prefixes) when expanding variables. So
it's possible to do something like this:
cd ${filename%/*}
> Thanks.
Good luck. Please let us know what you find out.
--
Grant. . . .
unix || die