(CommandList children: [ (FuncDef name: k_fs_resolve body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /)}) spids: [48 52] ) ) } spids: [46] ) ] spids: [44] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:dir) op:Equal rhs:{(DQ )} spids:[58])] spids: [56] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:base) op:Equal rhs:{(DQ )} spids:[65])] spids: [63] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-d)} {(DQ (${ VSub_Name path))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dir) op: Equal rhs: {(DQ (${ VSub_Name path))} spids: [88] ) ] spids: [88] ) ] spids: [16777215 85] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dir) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_dirname)} {(DQ (${ VSub_Name path))})] ) left_token: <Left_CommandSub '$('> spids: [101 109] ) ) } spids: [99] ) ] spids: [99] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:base) op: Equal rhs: { (DQ (/) (CommandSubPart command_list: (CommandList children: [(C {(k_fs_basename)} {(DQ (${ VSub_Name path))})] ) left_token: <Left_CommandSub '$('> spids: [116 124] ) ) } spids: [113] ) ] spids: [113] ) ] spids: [96 128] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name dir))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dir) op: Equal rhs: {(DQ (.))} spids: [150] ) ] spids: [150] ) ] spids: [16777215 147] ) ] spids: [16777215 156] ) (C {(printf)} {(DQ ('%s%s'))} { (DQ (CommandSubPart command_list: (CommandList children: [ (AndOr ops: [Op_DAmp] children: [(C {(cd)} {(DQ (${ VSub_Name dir))}) (C {(pwd)} {(-P)})] ) ] ) left_token: <Left_CommandSub '$('> spids: [167 181] ) ) } {(DQ (${ VSub_Name base))} ) ] spids: [41] ) spids: [37 40] ) (FuncDef name: k_fs_basename body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /)}) spids: [228 232] ) ) } spids: [226] ) ] spids: [224] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:extension) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(EmptyPart)}) spids: [240 243] ) ) } spids: [238] ) ] spids: [236] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name path> suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{('*') (Lit_Slash /)}) spids: [250 255] ) ) } spids: [248] ) ] spids: [248] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name extension))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name path> suffix_op: (StringUnary op_id: VOp1_Percent arg_word: {($ VSub_Name '$extension')} ) spids: [280 284] ) ) } spids: [278] ) ] spids: [278] ) ] spids: [16777215 275] ) ] spids: [16777215 288] ) (C {(printf)} {(DQ ('%s'))} { (DQ (BracedVarSub token: <VSub_Name path> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /)}) spids: [299 303] ) ) } ) ] spids: [221] ) spids: [217 220] ) (FuncDef name: k_fs_dirname body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /)}) spids: [341 345] ) ) } spids: [339] ) ] spids: [337] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:dirPath) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name path> suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ('*')}) spids: [353 358] ) ) } spids: [351] ) ] spids: [349] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name path))} {(Lit_Other ']')}) (C {(Lit_Other '[')} {(DQ (${ VSub_Name path))} {(Lit_Other '=')} {(DQ (${ VSub_Name dirPath))} {(Lit_Other ']')} ) ] ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dirPath) op: Equal rhs: {(DQ (.))} spids: [401] ) ] spids: [401] ) ] spids: [16777215 398] ) ] spids: [16777215 407] ) (C {(printf)} {(DQ ('%s'))} { (DQ (BracedVarSub token: <VSub_Name dirPath> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /)}) spids: [418 422] ) ) } ) ] spids: [334] ) spids: [330 333] ) (FuncDef name: k_fs_temp_dir body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpDir) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(mktemp)} {(-d)})]) left_token: <Left_CommandSub '$('> spids: [451 455] ) ) } spids: [449] ) ] spids: [447] ) (C {(k_log_debug)} {(DQ ("Created temporary directory: '") (${ VSub_Name tmpDir) ("'"))}) (SimpleCommand words: [{(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} {(DQ (${ VSub_Name tmpDir))}] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_predictable_file)} {(k-fs-temp-files)})] ) left_token: <Left_CommandSub '$('> spids: [489 493] ) ) } spids: [486] ) ] ) (C {(printf)} {(DQ ('%s'))} {(DQ (${ VSub_Name tmpDir))}) ] spids: [444] ) spids: [440 443] ) (FuncDef name: k_fs_temp_file body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpFile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(mktemp)})]) left_token: <Left_CommandSub '$('> spids: [536 538] ) ) } spids: [534] ) ] spids: [532] ) (C {(k_log_debug)} {(DQ ("Created temporary file: '") (${ VSub_Name tmpFile) ("'"))}) (SimpleCommand words: [{(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} {(DQ (${ VSub_Name tmpFile))}] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_predictable_file)} {(k-fs-temp-files)})] ) left_token: <Left_CommandSub '$('> spids: [572 576] ) ) } spids: [569] ) ] ) (C {(printf)} {(DQ ('%s'))} {(DQ (${ VSub_Name tmpFile))}) ] spids: [529] ) spids: [525 528] ) (FuncDef name: k_fs_predictable_dir body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpDir) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_fs_dirname)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(mktemp)} {(-u)})]) left_token: <Left_CommandSub '$('> spids: [635 639] ) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [631 641] ) (/) (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (CommandSubPart command_list: (CommandList children:[(C {(k_tool_name)})]) left_token: <Left_CommandSub '$('> spids: [646 648] ) } ) spids: [643 649] ) (.) ($ VSub_Dollar '$$') ) } spids: [629] ) ] spids: [627] ) (C {(mkdir)} {(-p)} {(DQ (${ VSub_Name tmpDir))}) (C {(k_log_debug)} {(DQ ("Created predictable temporary directory: '") (${ VSub_Name tmpDir) ("'"))} ) (SimpleCommand words: [{(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} {(DQ (${ VSub_Name tmpDir))}] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_predictable_file)} {(k-fs-temp-files)})] ) left_token: <Left_CommandSub '$('> spids: [696 700] ) ) } spids: [693] ) ] ) (C {(printf)} {(DQ ('%s'))} {(DQ (${ VSub_Name tmpDir))}) ] spids: [624] ) spids: [620 623] ) (FuncDef name: k_fs_predictable_file body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (CommandSubPart command_list: (CommandList children:[(C {(k_tool_name)})]) left_token: <Left_CommandSub '$('> spids: [758 760] ) } ) spids: [755 761] ) ) } spids: [753] ) ] spids: [751] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpFile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_fs_dirname)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(mktemp)} {(-u)})]) left_token: <Left_CommandSub '$('> spids: [773 777] ) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [769 779] ) (/) (${ VSub_Name name) (.) ($ VSub_Dollar '$$') ) } spids: [767] ) ] spids: [765] ) (C {(k_log_debug)} {(DQ ("Created predictable temporary file: '") (${ VSub_Name tmpFile) ("'"))} ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(DQ (${ VSub_Name name))} {(Lit_Other '=')} {(DQ (k-fs-temp-files))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} {(DQ (${ VSub_Name tmpFile))}] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_predictable_file)} {(k-fs-temp-files)})] ) left_token: <Left_CommandSub '$('> spids: [844 848] ) ) } spids: [841] ) ] ) ] spids: [16777215 824] ) ] spids: [16777215 852] ) (C {(printf)} {(DQ ('%s'))} {(DQ (${ VSub_Name tmpFile))}) ] spids: [748] ) spids: [744 747] ) (FuncDef name: k_fs_temp_cleanup body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tempFilesFile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_predictable_file)} {(k-fs-temp-files)})] ) left_token: <Left_CommandSub '$('> spids: [885 889] ) ) } spids: [883] ) ] spids: [881] ) (C {(k_log_info)} {(DQ ('Cleaning up temp files'))}) (While cond: [ (Sentence child: (SimpleCommand words: [{(read)} {(-r)} {(file)}] more_env: [(env_pair name:IFS val:{(EmptyPart)} spids:[902])] ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (C {(k_log_debug)} {(DQ ("Removing '") (${ VSub_Name file) ("'"))}) (C {(rm)} {(-rf)} {(DQ (${ VSub_Name file))}) ] spids: [911 936] ) redirects: [ (Redir op_id: Redir_Less fd: 16777215 arg_word: {(DQ (${ VSub_Name tempFilesFile))} spids: [938] ) ] ) (C {(k_log_debug)} {(DQ ("Removing '") (${ VSub_Name tempFilesFile) ("'"))}) (C {(rm)} {(-f)} {(DQ (${ VSub_Name tempFilesFile))}) ] spids: [878] ) spids: [874 877] ) ] )