heiko-barth.de

// cat & zcat kombiniert

catz
#!/bin/bash
 
[ -t 0 ] && [ "$1" == "" ] &&
        echo "Concatenate files (gziped files decompressed) and print on the standard output." >&2 &&
        echo "Syntax: catz [<files>]" >&2 &&
        echo >&2 &&
        exit 1
 
[ ! -t 0 ] && cat - # output STDIN
 
while [ 1 ]; do
        [ "$1" == "" ] && exit
        [ "$1" == "-" ] && shift && continue
        if [[ "$1" =~ gz$ ]]; then
                zcat "$1"
        else
                cat "$1"
        fi
        shift
done

Leave a comment…



  _      __   ____  ____   ____  _____   __ __   ____
 | | /| / /  /  _/ /_  /  / __/ / ___/  / // /  /  _/
 | |/ |/ /  _/ /    / /_ / _/  / /__   / _  /  _/ /  
 |__/|__/  /___/   /___//___/  \___/  /_//_/  /___/
  • E-Mail address will not be published.
  • Formatting:
    //italic//  __underlined__
    **bold**  ''preformatted''
  • Links:
    [[http://example.com]]
    [[http://example.com|Link Text]]
  • Quotation:
    > This is a quote. Don't forget the space in front of the text: "> "
  • Code:
    <code>This is unspecific source code</code>
    <code [lang]>This is specifc [lang] code</code>
    <code php><?php echo 'example'; ?></code>
    Available: html, css, javascript, bash, cpp, …
  • Lists:
    Indent your text by two spaces and use a * for
    each unordered list item or a - for ordered ones.
Web 2.0



RSS   RSS abonieren

Github   Github
QR Code