diff --git a/commands/core/core.drush.inc b/commands/core/core.drush.inc
index 1574128..f2e25f3 100644
--- a/commands/core/core.drush.inc
+++ b/commands/core/core.drush.inc
@@ -157,6 +157,7 @@ function core_drush_command() {
       'command' => 'The shell command to be executed.',
     ),
     'required-arguments' => TRUE,
+    'allow-additional-options' => TRUE,
     'examples' => array(
       'drush exec \'git pull\'' => 'Retrieve latest code from git',
     ),
@@ -730,7 +731,7 @@ function drush_core_quick_drupal() {
   drush_invoke('site-install', array(drush_get_option('profile')));
   // Log in with the admin user.
   // TODO: If site-install is given a sites-subdir other than 'default',
-  // then it will bootstrap to DRUSH_BOOTSTRAP_DRUPAL_SITE get the installer 
+  // then it will bootstrap to DRUSH_BOOTSTRAP_DRUPAL_SITE get the installer
   // to recognize the desired site directory. This somehow interferes
   // with our desire to bootstrap to DRUSH_BOOTSTRAP_DRUPAL_LOGIN here.
   // We could do the last few steps in a new process iff uri is not 'default'.
@@ -1021,6 +1022,9 @@ function drush_core_find_project_path($target) {
  * Command callback. Execute specified shell code. Often used by shell aliases
  * that start with !.
  */
-function drush_core_execute($script) {
-  return drush_op_system($script);
+function drush_core_execute() {
+  $args = func_get_args();
+  // @todo: get these options into $exec.
+  $options = drush_get_context('cli');
+  return (bool) !drush_op_system(implode(' ', $args));
 }
diff --git a/commands/core/ssh.drush.inc b/commands/core/ssh.drush.inc
index 39d4e41..a147368 100644
--- a/commands/core/ssh.drush.inc
+++ b/commands/core/ssh.drush.inc
@@ -64,29 +64,6 @@ function drush_ssh_site_ssh($alias, $command = NULL) {
     return;
   }
 
-  // Build up the command. TODO: We maybe refactor this soon.
-  $hostname = drush_escapeshellarg($site['remote-host'], "LOCAL");
-  $username = isset($site['remote-user']) ? drush_escapeshellarg($site['remote-user'], "LOCAL") . "@" : '';
-  $ssh_options = isset($site['ssh-options']) ? $site['ssh-options'] : drush_get_option('ssh-options', "-o PasswordAuthentication=no");
-  if (drush_get_option('tty')) {
-    $ssh_options .= ' -t';
-  }
-
-  $cmd = "ssh " . $ssh_options . " " . $username . $hostname;
-  if (!empty($command)) {
-    if (!drush_get_option('escaped', FALSE)) {
-      $cmd .= " " . drush_escapeshellarg($command);
-    }
-    else {
-      $cmd .= " $command";
-    }
-  }
-
-  // Execute.
-  if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
-    drush_print($cmd);
-  }
-  if (!drush_get_context('DRUSH_SIMULATE')) {
-    proc_close(proc_open($cmd, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes));
-  }
+  $cmd = drush_shell_proc_build($site, $command);
+  drush_shell_proc_open($cmd);
 }
diff --git a/commands/sql/sql.drush.inc b/commands/sql/sql.drush.inc
index 6578ae7..28b09ad 100644
--- a/commands/sql/sql.drush.inc
+++ b/commands/sql/sql.drush.inc
@@ -620,7 +620,8 @@ function _drush_sql_drop($db_spec = NULL) {
 
 function drush_sql_cli() {
   drush_sql_bootstrap_further();
-  proc_close(proc_open(_drush_sql_connect(), array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes));
+  $cmd = _drush_sql_connect();
+  drush_shell_proc_open($cmd);
 }
 
 /**
diff --git a/includes/exec.inc b/includes/exec.inc
index 2bf1e38..e5ee7c8 100644
--- a/includes/exec.inc
+++ b/includes/exec.inc
@@ -145,6 +145,49 @@ function _drush_shell_exec($args, $interactive = FALSE) {
 }
 
 /**
+ * Build an SSH string including an optional fragment of bash.
+ *
+ * @param array $site
+ *   A site alias record.
+ * @param string $command
+ *   An optional bash fragment.
+ * @return string
+ *   A string suitable for execution with drush_shell_remote_exec().
+ */
+function drush_shell_proc_build($site, $command = NULL) {
+  // Build up the command. TODO: We maybe refactor this soon.
+  $hostname = drush_escapeshellarg($site['remote-host'], "LOCAL");
+  $username = isset($site['remote-user']) ? drush_escapeshellarg($site['remote-user'], "LOCAL") . "@" : '';
+  $ssh_options = isset($site['ssh-options']) ? $site['ssh-options'] : drush_get_option('ssh-options', "-o PasswordAuthentication=no");
+  if (drush_get_option('tty')) {
+    $ssh_options .= ' -t';
+  }
+
+  $cmd = "ssh " . $ssh_options . " " . $username . $hostname;
+  if (!empty($command)) {
+    if (!drush_get_option('escaped', FALSE)) {
+      $cmd .= " " . drush_escapeshellarg($command);
+    }
+    else {
+      $cmd .= " $command";
+    }
+  }
+  return $cmd;
+}
+
+/*
+ * Execute bash command using proc_open().
+ */
+function drush_shell_proc_open($cmd) {
+  if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
+    drush_print("Calling proc_open($cmd);");
+  }
+  if (!drush_get_context('DRUSH_SIMULATE')) {
+    proc_close(proc_open($cmd, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes));
+  }
+}
+
+/**
  * Determine the appropriate os value for the
  * specified site record
  *
diff --git a/tests/shellAliasTest.php b/tests/shellAliasTest.php
index ce67ff7..73a0ebb 100644
--- a/tests/shellAliasTest.php
+++ b/tests/shellAliasTest.php
@@ -7,20 +7,70 @@
 class shellAliasesCase extends Drush_CommandTestCase {
 
   /*
-   * Assure that shell aliases expand as expected.
+   * Setup config file contains shell aliases array.
    */
-  public function testShellAliases() {
+  static function setupBeforeClass() {
+    parent::setUpBeforeClass();
     $contents = "
       <?php
 
-      \$options['shell-aliases'] = array('glopts' => 'topic core-global-options');
+      \$options['shell-aliases'] = array(
+        'glopts' => 'topic core-global-options',
+        'pull' => '!git pull',
+      );
     ";
     file_put_contents(UNISH_SANDBOX . '/drushrc.php', $contents);
+  }
+
+  /*
+   * Test shell aliases to Drush commands.
+   */
+  public function testShellAliasDrushLocal() {
     $options = array(
       'config' => UNISH_SANDBOX,
     );
     $this->drush('glopts', array('php_configuration'), $options);
     $output = $this->getOutput();
-    $this->assertContains('These options are applicable to most drush commands.', $output);
+    $this->assertContains('These options are applicable to most drush commands.', $output, 'Successfully executed local shell alias to drush command');
+  }
+
+  /*
+   * Test shell aliases to Bash commands. Assure we pass along extra arguments
+   * and options.
+   */
+  public function testShellAliasBashLocal() {
+    $options = array(
+      'config' => UNISH_SANDBOX,
+      'simulate' => NULL,
+      'rebase' => NULL,
+    );
+    $this->drush('pull', array('origin'), $options);
+    $output = $this->getOutput();
+    $this->assertContains('Calling system(git pull origin --rebase);', $output);
+  }
+
+  public function testShellAliasDrushRemote() {
+    $options = array(
+      'config' => UNISH_SANDBOX,
+      'simulate' => NULL,
+    );
+    $this->drush('glopts', array('php_configuration'), $options, 'user@server/path/to/drupal#sitename');
+    // $expected might be different on non unix platforms. We shall see.
+    $expected = "Simulating backend invoke: ssh user@server 'drush --simulate --uri=sitename --root=/path/to/drupal topic core-global-options --invoke 2>&1' 2>&1";
+    $output = $this->getOutput();
+    $this->assertEquals($expected, $output, 'Expected remote shell alias to a drush command was built');
+  }
+
+  public function testShellAliasBashRemote() {
+    $options = array(
+      'config' => UNISH_SANDBOX,
+      'simulate' => NULL,
+      'rebase' => NULL,
+    );
+    $this->drush('pull', array('origin'), $options, 'user@server/path/to/drupal#sitename');
+    // $expected might be different on non unix platforms. We shall see.
+    $expected = "Calling proc_open(ssh user@server \"cd '/path/to/drupal' && git pull origin --rebase\");";
+    $output = $this->getOutput();
+    $this->assertEquals($expected, $output, 'Expected remote shell alias to a bash command was built');
   }
-}
\ No newline at end of file
+}
