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