Last active
August 20, 2017 01:48
-
-
Save rollbackpt/b4e17e2f4c23471973e122a50d591602 to your computer and use it in GitHub Desktop.
Script to Run Multiple Tail Commands in Different Command Line Tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Blog Post: http://joaoperibeiro.com/command-line-script-to-launch-multiple-tabs/ | |
# Array of commands to run in different tabs | |
commands=( | |
'tail -f /var/log/apache2/access.log' | |
'tail -f /var/log/apache2/error.log' | |
'tail -f /usr/local/var/postgres/server.log' | |
) | |
# Build final command with all the tabs to launch | |
set finalCommand="" | |
for (( i = 0; i < ${#commands[@]}; i++ )); do | |
export finalCommand+="--tab -e 'bash -c \"${commands[$i]}\"' " | |
done | |
# Run the final command | |
eval "gnome-terminal "$finalCommand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more info check http://joaoperibeiro.com/command-line-script-to-launch-multiple-tabs/