blob: 126b7fcec62722574eade80bdadc34177c144569 (
plain)
1
2
3
4
5
6
7
8
9
|
#!/bin/bash
shopt -s extglob nullglob
declare -a zipped_files=($( printf "%s\n" /var/log/messages*.gz | sort -r ))
declare -a plain_files=($( printf "%s\n" /var/log/messages!(*.gz) | sort -r ))
[ ${#zipped_files[@]} -gt 0 ] && gunzip --stdout ${zipped_files[@]}
[ ${#plain_files[@]} -gt 0 ] && cat ${plain_files[@]}
|