Skip to content

Instantly share code, notes, and snippets.

@M1ke
Last active August 29, 2015 14:05
Show Gist options
  • Save M1ke/a1ef39d6f4f9b22e72eb to your computer and use it in GitHub Desktop.
Save M1ke/a1ef39d6f4f9b22e72eb to your computer and use it in GitHub Desktop.
Gnome terminal watch tabs. A quick way to open a new terminal with multiple tabs for watch commands (specifically used in this case because the ruby-sass plugin for gulp is really slow).
#!/bin/bash
gnome-terminal -t "watch" --tab -e "bash -c 'gulp watch'" --tab -e "bash -c 'compass watch'"
@M1ke
Copy link
Author

M1ke commented Aug 7, 2014

Syntax:

-t sets terminal title
--tab begins a new tab within the window
-e starts a command in the tab (quoted)

In order to not run the command (e.g. "gulp watch") and have the terminal close we need to then run bash around the command.

bash executes the following command with bash
-c preface to the command
Then our command in single quotes (to avoid closing the quotes from the -e command)

End the quotes and add as many further --tab directives as you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment