#!/bin/bash -e # # Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # set -o pipefail for arg in [@Argv] { if [[ $arg == *.gz ]] { gunzip -c $(arg) } else { cat $(arg) } } (CommandList children: [ (C {(set)} {(-o)} {(pipefail)}) (ForEach iter_name: arg iter_words: [{(DQ ($ VSub_At "$@"))}] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$arg")} right: {(Lit_Other "*") (.gz)} ) ) terminator: ) ] action: [(C {(gunzip)} {(-c)} {(DQ (${ VSub_Name arg))})] spids: [-1 82] ) ] else_action: [(C {(cat)} {(DQ (${ VSub_Name arg))})] spids: [96 108] ) ] spids: [65 110] ) spids: [59 63] ) ] )