import sublime, sublime_plugin

import os
from .common.utils import run_bash_for_output
from .common.utils import git_path_for_window

last_command = ""

class RunBash(sublime_plugin.WindowCommand):
    def run(self):
        global last_command
        window = self.window
        view = window.active_view()
        if view.file_name() is not None:
            path = os.path.join(os.path.dirname(view.file_name()), '')
            window.show_input_panel(
                'Bash:',
                last_command,
                lambda command: (
                    self.run_bash(path, command)
                ),
                None,
                None
            )

    def run_bash(self, path, command):
        global last_command
        last_command = command

        if command.startswith('$'):
            command = command[1:]
            path = git_path_for_window(self.window)

        final_command = "cd '{0}'; {1}".format(path, command)
        output, err = run_bash_for_output(final_command)
        new_content = output + '\n' + (100 * '=') + '\n' + err

        results_view = self.window.new_file()
        results_view.set_scratch(True)

        results_view.set_name("BashOutput")

        # deps: this is from utilities.py
        results_view.run_command('replace_content', {"new_content": new_content})
        results_view.sel().clear()
        results_view.sel().add(sublime.Region(0, 0))

        self.window.focus_view(results_view)

@@ -416,16 +416,75 @@
 )), '')%0A
+            file_name = os.path.basename(view.file_name())%0A
         
@@ -512,16 +512,16 @@
 _panel(%0A
-
         
@@ -636,24 +636,35 @@
 n_bash(path,
+ file_name,
  command)%0A  
@@ -762,24 +762,35 @@
 (self, path,
+ file_name,
  command):%0A 
@@ -918,16 +918,16 @@
 and%5B1:%5D%0A
-
         
@@ -971,16 +971,67 @@
 indow)%0A%0A
+        command = command.replace(%22@%22, file_name)%0A%0A
         

Allow to use @ for filename for running bash command