Skip to content

Instantly share code, notes, and snippets.

@rollbackpt
Last active August 20, 2017 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rollbackpt/b4e17e2f4c23471973e122a50d591602 to your computer and use it in GitHub Desktop.
Save rollbackpt/b4e17e2f4c23471973e122a50d591602 to your computer and use it in GitHub Desktop.
Script to Run Multiple Tail Commands in Different Command Line Tabs
#!/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
@rollbackpt
Copy link
Author

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