Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Show comment
Hide comment
Owner

rollbackpt commented Jun 20, 2017

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