(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:archivedir) op: Equal rhs: {(DQ ($ VSub_Name '$HOME') (/.deleted-files))} spids: [17] ) ] spids: [17] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:realrm) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(which)} {(rm)})]) left_token: <Left_CommandSub '$('> spids: [25 29] ) ) } spids: [23] ) ] spids: [23] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:move) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(which)} {(mv)})]) left_token: <Left_CommandSub '$('> spids: [34 38] ) ) } spids: [32] ) ] spids: [32] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dest) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [43 45] ) } spids: [42] ) ] spids: [42] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-d)} {($ VSub_Name '$archivedir')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} {(DQ ($ VSub_Number '$0') (': No deleted files directory: nothing to unrm'))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[72])] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 62] ) ] spids: [16777215 81] ) (C {(cd)} {($ VSub_Name '$archivedir')}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-eq)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Contents of your deleted files archive (sorted by date):'))}) (Pipeline children: [ (C {(ls)} {(-FC)}) (C {(sed)} {(-e)} {(SQ <'s/\\([[:digit:]][[:digit:]]\\.\\)\\{5\\}//g'>)} {(-e)} {(SQ <'s/^/ /'>)} ) ] negated: F ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] spids: [16777215 106] ) ] spids: [16777215 144] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:matches) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (SimpleCommand words: [{(ls)} {(-d)} {(Lit_Other '*') (DQ ($ VSub_Number '$1'))}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [169] ) ] ) (C {(wc)} {(-l)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [159 178] ) ) } spids: [157] ) ] spids: [157] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$matches')} {(-eq)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ('No match for ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Number '$1') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' in the deleted file archive.') ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[209])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 196] ) ] spids: [16777215 217] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$matches')} {(-gt)} {(1)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('More than one file or directory match in the archive:'))}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:index) op:Equal rhs:{(1)} spids:[244])] spids: [244] ) (ForEach iter_name: name iter_words: [ { (CommandSubPart command_list: (CommandList children: [(C {(ls)} {(-td)} {(Lit_Other '*') (DQ ($ VSub_Number '$1'))})] ) left_token: <Left_CommandSub '$('> spids: [254 263] ) } ] do_arg_iter: F body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:datetime) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$name')}) (C {(cut)} {(-c1-14)}) (C {(awk)} {(-F.)} {(SQ <'{ print $5"/"$4" at "$3":"$2":"$1 }'>)} ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [271 292] ) ) } spids: [269] ) ] spids: [269] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:filename) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$name')}) (C {(cut)} {(-c16-)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [298 308] ) ) } spids: [296] ) ] spids: [296] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-d)} {($ VSub_Name '$name')} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:filecount) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(ls)} {($ VSub_Name '$name')}) (C {(wc)} {(-l)}) (C {(sed)} {(SQ <'s/[^[:digit:]]//g'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [329 347] ) ) } spids: [327] ) ] spids: [327] ) (C {(echo)} { (DQ (' ') ($ VSub_Name '$index') (') ') ($ VSub_Name '$filename') (' (contents = ') (${ VSub_Name filecount) (' items,') ) } {(EscapedLiteralPart token:<Lit_EscapedChar '\\ '>)} ) (C {(DQ (' deleted = ') ($ VSub_Name '$datetime') (')'))}) ] spids: [16777215 324] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:size) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(ls)} {(-sdk1)} {($ VSub_Name '$name')}) (C {(awk)} {(SQ <'{print $1}'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [380 394] ) ) } spids: [378] ) ] spids: [378] ) (C {(echo)} { (DQ (' ') ($ VSub_Name '$index') (') ') ($ VSub_Name '$filename') (' (size = ') (${ VSub_Name size) ('Kb, deleted = ') ($ VSub_Name '$datetime') (')') ) } ) ] spids: [375 415] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:index) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$index')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [419 427] ) } spids: [418] ) ] spids: [418] ) ] spids: [266 430] ) spids: [253 16777215] ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} { (DQ ('Which version of ') ($ VSub_Number '$1') (" do you want to restore ('0' to quit)? [1] : ") ) } ) (C {(read)} {(desired)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$desired')}) (C {(sed)} {(SQ <'s/[[:digit:]]//g'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [464 476] ) ) } {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ($ VSub_Number '$0') (': Restore canceled by user: invalid input.'))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[493])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 483] ) ] spids: [16777215 502] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} { (BracedVarSub token: <VSub_Name desired> suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(1)}) spids: [510 514] ) } {(-ge)} {($ VSub_Name '$index')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ($ VSub_Number '$0') (': Restore canceled by user: index value too big.') ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[534])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 524] ) ] spids: [16777215 543] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$desired')} {(-lt)} {(1)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$0') (': restore canceled by user.'))}] redirects: [ (Redir op_id: Redir_GreatAnd fd: 16777215 arg_word: {(2)} spids: [571] ) ] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 561] ) ] spids: [16777215 581] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:restore) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(ls)} {(-td1)} {(Lit_Other '*') (DQ ($ VSub_Number '$1'))}) (C {(sed)} {(-n)} {(DQ (${ VSub_Name desired) (p))}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [587 609] ) ) } spids: [585] ) ] spids: [585] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-e)} {(DQ ($ VSub_Name '$dest') (/) ($ VSub_Number '$1'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Number '$1') (EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) (' already exists in this directory. Cannot overwrite.') ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[643])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 631] ) ] spids: [16777215 652] ) (C {(echo)} {(-n)} { (DQ ('Restoring file ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Number '$1') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' ...') ) } ) (C {($ VSub_Name '$move')} {(DQ ($ VSub_Name '$restore'))} {(DQ ($ VSub_Name '$dest') (/) ($ VSub_Number '$1'))} ) (C {(echo)} {(DQ (done.))}) (C {(echo)} {(-n)} {(DQ ('Delete the additional copies of this file? [y] '))}) (C {(read)} {(answer)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} { (BracedVarSub token: <VSub_Name answer> suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(y)}) spids: [711 715] ) } {(Lit_Other '=')} {(DQ (y))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {($ VSub_Name '$realrm')} {(-rf)} {(Lit_Other '*') (DQ ($ VSub_Number '$1'))}) (C {(echo)} {(DQ (deleted.))}) ] spids: [16777215 727] ) ] else_action: [(C {(echo)} {(DQ ('additional copies retained.'))})] spids: [747 757] ) ] spids: [16777215 234] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-e)} {(DQ ($ VSub_Name '$dest') (/) ($ VSub_Number '$1'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Number '$1') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' already exists in this directory. Cannot overwrite.') ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[790])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 778] ) ] spids: [16777215 799] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:restore) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(ls)} {(-d)} {(Lit_Other '*') (DQ ($ VSub_Number '$1'))})] ) left_token: <Left_CommandSub '$('> spids: [805 814] ) ) } spids: [803] ) ] spids: [803] ) (C {(echo)} {(-n)} { (DQ ('Restoring file ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Number '$1') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' ... ') ) } ) (C {($ VSub_Name '$move')} {(DQ ($ VSub_Name '$restore'))} {(DQ ($ VSub_Name '$dest') (/) ($ VSub_Number '$1'))} ) (C {(echo)} {(DQ (done.))}) ] spids: [759 852] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] )