Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to Run Multiple Tail Commands in Different Command Line Tabs
# Blog Post:
# Array of commands to run in different tabs
'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]}\"' "
# Run the final command
eval "gnome-terminal "$finalCommand

This comment has been minimized.

Copy link
Owner Author

@rollbackpt rollbackpt commented Jun 20, 2017

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