Run a command with relative path from symlink directory

I’ve got a directory structure like this:

bin
  drush
build -> vendor/drupal/core
vendor
  drupal
    core

So as you see, build is a symlink to the core directory.
drush is an executable file. I need to be able to cd into build and call drush from there.

But if I do this:

cd build
../bin/drush

This doesn’t work, because .. points to vendor/drupal directory, because when I cd into build, it in fact goes to vendor/drupal/core, of course.

I know I can call it this way: ../../../bin/drush, but is there some kind of workaround to make .. point to the root, not the actual parent?


Source: unix

Leave a Reply