2023-04-18 11:27:51 +02:00
|
|
|
#!/bin/bash
|
2023-04-18 11:20:51 +02:00
|
|
|
|
2023-04-18 11:27:51 +02:00
|
|
|
# On Darwin: try gzcat if available, otherwise use Python
|
2023-04-18 11:20:51 +02:00
|
|
|
|
2023-04-18 11:27:51 +02:00
|
|
|
if [[ $(uname -s) = Darwin ]] ; then
|
|
|
|
which gzcat &> /dev/null
|
|
|
|
if [[ $? -eq 0 ]] ; then
|
|
|
|
exec gzcat $@
|
|
|
|
else
|
2023-04-18 11:20:51 +02:00
|
|
|
|
2023-04-18 11:27:51 +02:00
|
|
|
exec python3 << EOF
|
|
|
|
import sys
|
|
|
|
import gzip
|
|
|
|
with gzip.open("$1", "rt") as f:
|
2023-04-18 11:20:51 +02:00
|
|
|
print(f.read())
|
2023-04-18 11:27:51 +02:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
command=$(which -a zcat | grep -v 'qp2/bin/' | head -1)
|
|
|
|
exec command
|
|
|
|
fi
|
2023-04-18 11:20:51 +02:00
|
|
|
|