(command.CommandList children: [ (C {(KW_Set set)} {(-o)} {(nounset)}) (C {(KW_Set set)} {(-o)} {(pipefail)}) (C {(KW_Set set)} {(-o)} {(errexit)}) (C {(readonly)} {(Lit_VarLike 'FILES=') (sh_array_literal left: <Op_LParen '('> words: [ {(../) (Lit_Star '*') (.sh)} {(../) (Lit_Star '*') (/) (Lit_Star '*') (.sh)} {(../) (Lit_Star '*') (.py)} {(../) (Lit_Star '*') (/) (Lit_Star '*') (.py)} {(../) (Lit_Star '*') (/) (Lit_Star '*') (/) (Lit_Star '*') (.py)} ] ) } ) (command.ShFunction name: test-awk body: (command.BraceGroup children: [ (command.ForEach iter_name: awk iter_words: [ {(gawk)} {(mawk)} {(word_part.TildeSub token:<Lit_TildeLike '~'>) (/git/bwk/bwk)} ] do_arg_iter: F body: (command.DoGroup children: [ (C {(echo)} {(---)}) (C {(echo)} {($ VSub_DollarName '$awk')}) (C {(echo)} {(---)}) (command.TimeBlock pipeline: (command.ForEach iter_name: i iter_words: [ (word.BracedTree parts: [(word_part.BracedRange kind:Range_Int start:1 end:10 step:1)] ) ] do_arg_iter: F body: (command.DoGroup children: [ (C {($ VSub_DollarName '$awk')} { (SQ <'\n'> <' { \n'> <' line = tolower($0)\n'> <' num_lines += 1\n'> <'\n'> <' # NOTE: gawk has length(); mawk does not\n'> <' if (!(line in unique)) {\n'> <' num_unique += 1\n'> <' }\n'> <' unique[line] += 1\n'> <' }\n'> <' END {\n'> <' print "unique lines: " num_unique\n'> <' print "total lines: " num_lines\n'> <' }\n'> <' '> ) } {(DQ (braced_var_sub token:<VSub_Name FILES> bracket_op:(bracket_op.WholeArray op_id:Lit_At)))} ) ] ) ) ) ] ) ) ] ) ) (command.ShFunction name: test-python body: (command.BraceGroup children: [ (command.TimeBlock pipeline: (command.ForEach iter_name: i iter_words: [ (word.BracedTree parts: [(word_part.BracedRange kind:Range_Int start:1 end:10 step:1)] ) ] do_arg_iter: F body: (command.DoGroup children: [ (C {(python)} {(-S)} {(-c)} { (SQ <'\n'> <'import collections\n'> <'import sys\n'> <'\n'> <'num_lines = 0\n'> <'num_unique = 0\n'> <'unique = collections.defaultdict(int)\n'> <'\n'> <'for path in sys.argv[1:]:\n'> <' with open(path) as f:\n'> <' for line in f:\n'> <' line = line.lower()\n'> <' num_lines += 1\n'> <'\n'> <' if line not in unique:\n'> <' num_unique += 1\n'> <' unique[line] += 1\n'> <'\n'> <'print "unique lines: ", num_unique\n'> <'print "total lines: ", num_lines\n'> <' '> ) } {(DQ (braced_var_sub token:<VSub_Name FILES> bracket_op:(bracket_op.WholeArray op_id:Lit_At)))} ) ] ) ) ) ] ) ) (command.ShFunction name: test-wc body: (command.BraceGroup children: [ (command.TimeBlock pipeline: (command.ForEach iter_name: i iter_words: [ (word.BracedTree parts: [(word_part.BracedRange kind:Range_Int start:1 end:10 step:1)] ) ] do_arg_iter: F body: (command.DoGroup children: [ (command.Pipeline children: [ (C {(cat)} { (DQ (braced_var_sub token: <VSub_Name FILES> bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) ) } ) (C {(wc)} {(-c)}) ] negated: F ) ] ) ) ) ] ) ) (command.ShFunction name: files body: (command.BraceGroup children: [ (C {(echo)} { (DQ (braced_var_sub token: <VSub_Name FILES> bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) ) } ) (C {(echo)} { (DQ (braced_var_sub token: <VSub_Name FILES> prefix_op: VSub_Pound bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) (' files') ) } ) ] ) ) (C {(DQ ($ VSub_At '$@'))}) ] )