Skip to content

Instantly share code, notes, and snippets.

@wangchen
Created July 9, 2015 06:21
Show Gist options
  • Save wangchen/cae150fa3d3d01f8396e to your computer and use it in GitHub Desktop.
Save wangchen/cae150fa3d3d01f8396e to your computer and use it in GitHub Desktop.
combined 'cat' and 'zcat' in one line
#!/bin/sh
for f in "$@"
do
test ${f: -3} = ".gz" && c="zcat" || c="cat"
$c $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment