(command.CommandList children: [ (command.ShFunction name: usage body: (command.BraceGroup children: [ (command.Simple words: [ {(echo)} { (DQ ('Usage: ') (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:56) command_list: (command.CommandList children: [(C {(basename)} {($ Id.VSub_Number '$0')})] ) ) (' file|device string') ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:64) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:68) arg_word: {(1)} ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:COLUMNS) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:76) command_list: (command.CommandList children:[(C {(tput)} {(cols)})]) ) } spids: [75] ) ] ) (command.ShFunction name: progress body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DONE) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$COLUMNS')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 2)}) ) right: (arith_expr.ArithWord w:{($ Id.VSub_Number '$1')}) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 100)}) ) ) } spids: [93] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:TODO) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$COLUMNS')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 2)}) ) right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$DONE')}) ) ) } spids: [112] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DONE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:124) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(printf)} {(DQ ('%') (${ Id.VSub_Name DONE) (s))}) (C {(tr)} {(SQ (Token id:Id.Lit_Chars val:' ' span_id:140))} {(Id.Lit_Equals '=')} ) ] negated: F ) ] ) ) } spids: [123] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:TODO) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:148) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(printf)} {(DQ ('%') (${ Id.VSub_Name TODO) (s))}) (C {(tr)} {(SQ (Token id:Id.Lit_Chars val:' ' span_id:164))} {(-)}) ] negated: F ) ] ) ) } spids: [147] ) ] ) (command.Simple words: [ {(printf)} { (DQ ('[') ($ Id.VSub_DollarName '$DONE') ($ Id.VSub_DollarName '$TODO') (']') (Id.Lit_Other '\\') (r) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:182) fd: -1 arg_word: {(/dev/tty)} ) ] ) ] ) ) (command.ShFunction name: print body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:CLEAR) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:200) command_list: (command.CommandList children: [(C {(printf)} {(DQ ('%') (${ Id.VSub_Name COLUMNS) (s))})] ) ) } spids: [199] ) ] ) (C {(printf)} {(DQ ($ Id.VSub_DollarName '$CLEAR') (Id.Lit_Other '\\') (r))}) (C {(echo)} {(DQ ($ Id.VSub_At '$@'))}) ] ) ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {($ Id.VSub_Pound '$#')} {(-ne)} {(2)} {(Id.Lit_RBracket ']')}) (C {(usage)}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DISK) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [245] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:STRING) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [250] ) ] ) (C {(export)} {(Id.Lit_VarLike 'LANG=') (C)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:CHUNK_SIZE) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.ArithWord w:{(Id.Lit_Digits 8)}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1024)}) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1024)}) ) ) } spids: [280] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-b)} {(DQ ($ Id.VSub_DollarName '$DISK'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:301) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SIZE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:307) command_list: (command.CommandList children: [ (C {(/sbin/blockdev)} {(--getsize64)} {($ Id.VSub_DollarName '$DISK')}) ] ) ) } spids: [306] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:317) arg_word: {($ Id.VSub_QMark '$?')} ) ] ) ] spids: [290 303] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SIZE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:328) command_list: (command.CommandList children: [ (C {(stat)} {(--format)} {(Id.Lit_Other '%') (s)} {(DQ ($ Id.VSub_DollarName '$DISK'))} ) ] ) ) } spids: [327] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:343) arg_word: {($ Id.VSub_QMark '$?')} ) ] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$SIZE')} {(-eq)} {(0)} {(Id.Lit_RBracket ']')}) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:361)) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:CHUNKS) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$SIZE')}) right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$CHUNK_SIZE')}) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$CHUNK_SIZE')}) ) ) } spids: [363] ) ] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:i) op:assign_op.Equal rhs:{(0)} spids:[378])] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:381) cond: [ (command.Sentence child: (C {(true)}) terminator: (Token id:Id.Op_Semi val:';' span_id:384) ) ] body: (command.DoGroup children: [ (C {(progress)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 100)}) ) right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$CHUNKS')}) ) ) } ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$i'))} {(-ge)} {(DQ ($ Id.VSub_DollarName '$CHUNKS'))} {(Id.Lit_RBracket ']')} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:417) ) ] ) (command.Pipeline children: [ (command.Simple words: [ {(dd)} {(Id.Lit_VarLike 'if=') ($ Id.VSub_DollarName '$DISK')} {(Id.Lit_VarLike 'iflag=') (direct)} {(Id.Lit_VarLike 'conv=') (noerror)} {(Id.Lit_VarLike 'bs=') ($ Id.VSub_DollarName '$CHUNK_SIZE')} {(Id.Lit_VarLike 'count=') (1)} {(Id.Lit_VarLike 'skip=') ($ Id.VSub_DollarName '$i')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:444) fd: 2 arg_word: {(/dev/null)} ) ] ) (command.Simple words: [ {(grep)} {(--binary-files) (Id.Lit_Equals '=') (text)} {(-U)} {(-F)} {(DQ ($ Id.VSub_DollarName '$STRING'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:468) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: F ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:status) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:473) command_list: (command.CommandList children: [ (C {(echo)} { (braced_var_sub token: (Token id:Id.VSub_Name val:PIPESTATUS span_id:477) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) } ) ] ) ) } spids: [472] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dd_status) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:486) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$status')}) (C {(cut)} {(-f1)} {(-d)} {(SQ (Token id:Id.Lit_Chars val:' ' span_id:500))} ) ] negated: F ) ] ) ) } spids: [485] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:re_status) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:506) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$status')}) (C {(cut)} {(-f2)} {(-d)} {(SQ (Token id:Id.Lit_Chars val:' ' span_id:520))} ) ] negated: F ) ] ) ) } spids: [505] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$dd_status')} {(-ne)} {(0)} {(Id.Lit_RBracket ']')} ) (command.BraceGroup children: [ (command.Sentence child: (command.Simple words: [{(echo)} {(DQ ('dd error'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:545) fd: -1 arg_word: {(2)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:547) ) (command.Sentence child: (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:549) arg_word: {($ Id.VSub_DollarName '$dd_status')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:552) ) ] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$re_status')} {(-eq)} {(0)} {(Id.Lit_RBracket ']')} ) (command.BraceGroup children: [ (command.Sentence child: (C {(print)} { (DQ ('dd if=') ($ Id.VSub_DollarName '$DISK') (' iflag=direct bs=') ($ Id.VSub_DollarName '$CHUNK_SIZE') (' count=1 skip=') ($ Id.VSub_DollarName '$i') (' > disk_grep.') ($ Id.VSub_DollarName '$i') ) } ) terminator: (Token id:Id.Op_Semi val:';' span_id:583) ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [588] ) ] ) ] ) ) (C {(echo)}) ] )