Last active
December 21, 2015 20:09
-
-
Save bmoore/6358811 to your computer and use it in GitHub Desktop.
tmux split and tail all your files in the logs directory.
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 | |
if [ !-d 'logs' ] | |
then | |
echo "No logs!" | |
exit 1 | |
fi | |
i=0 | |
count=$(ls logs | grep log | wc -l) | |
perc=$((100/$count)) | |
echo $perc | |
tmux start | |
for file in $(ls logs | grep log); do | |
if [ $i -eq '0' ] | |
then | |
tmux new-session -d "tail -f logs/$file" | |
else | |
tmux splitw -d "tail -f logs/$file" | |
fi | |
let i+=1 | |
done | |
tmux select-layout even-horizontal | |
tmux attach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment