What are some ways to tell if you are currently on the same Drupal installation as your code?
drush status may give you some info that you need, but probably not. 

If you have unique site names setup, then this should work:

drush vget site_name


If not, then read on...

Is this a multisite setup?  If so, then the mapping of hostname onto sites/{sitename} will be either fully automatic based on these rules or determined by the configuration in sites.php.

If it's not a multisite setup and you instead have fully separate directories for each site then the mapping of hostname > directory is determined by your vhost setup.

In either case, I don't think there's any drush command that will just spit out which hostname you should be using to access the site based upon the directory you run it in.

Instead, I'd suggest you set up some drush aliases that let you be much more purposeful about running drush commands against a specific directory and hostname.  So, if you have a site at example.com, a simple alias might look like 

$aliases['example.com'] = array(
 'root' =&gt; '/path/to/example',
 'uri' =&gt; 'example.com',
);


Then, anytime you want to run drush commands against example.com it doesn't matter what directory you're in, as long as you have access to drush (stick it in your path) you can run:

drush @example.com arbitrarydrushcommandhere


Take the time to set up your aliases and hopefully you'll be more sane.