#! /bin/bash # This script expects the following arguments # $1: Path to dart executable # $2: Path to dart echoing script # $3: Argument to dart echoing script (0, 1 or 2) # $4: File for output from piping stdout and stderr # $5: File prefix for output from redirecting stdout and stderr to a file. # $6: Stdio type of stdin # Test piping and stdio file redirection. echo "Hello" | $1 $2 $3 pipe pipe pipe !2 > !1 | cat - > $4 $1 $2 $3 $6 file file < $4 > $5.stdout !2 > $5.stderr $1 $2 $3 $6 file file < $4 >> $5.stdout !2 2>> $5.stderr $1 $2 $3 $6 terminal terminal < $4 > /dev/null !2 > /dev/null $1 $2 $3 $6 terminal pipe < $4 !2 > !1 > /dev/null $1 $2 $3 $6 terminal terminal < $4 > /dev/null !2 > !1 (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (Hello))}) (SimpleCommand words: [ {($ VSub_Number "$1")} {($ VSub_Number "$2")} {($ VSub_Number "$3")} {(pipe)} {(pipe)} {(pipe)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[49])] ) (SimpleCommand words: [{(cat)} {(-)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Number "$4")} spids:[58])] ) ] negated: False ) (SimpleCommand words: [ {($ VSub_Number "$1")} {($ VSub_Number "$2")} {($ VSub_Number "$3")} {($ VSub_Number "$6")} {(file)} {(file)} ] redirects: [ (Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Number "$4")} spids:[74]) (Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Number "$5") (.stdout)} spids:[78]) (Redir op_id:Redir_Great fd:2 arg_word:{($ VSub_Number "$5") (.stderr)} spids:[83]) ] ) (SimpleCommand words: [ {($ VSub_Number "$1")} {($ VSub_Number "$2")} {($ VSub_Number "$3")} {($ VSub_Number "$6")} {(file)} {(file)} ] redirects: [ (Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Number "$4")} spids:[100]) (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Number "$5") (.stdout)} spids: [104] ) (Redir op_id:Redir_DGreat fd:2 arg_word:{($ VSub_Number "$5") (.stderr)} spids:[109]) ] ) (SimpleCommand words: [ {($ VSub_Number "$1")} {($ VSub_Number "$2")} {($ VSub_Number "$3")} {($ VSub_Number "$6")} {(terminal)} {(terminal)} ] redirects: [ (Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Number "$4")} spids:[126]) (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[130]) (Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[134]) ] ) (SimpleCommand words: [ {($ VSub_Number "$1")} {($ VSub_Number "$2")} {($ VSub_Number "$3")} {($ VSub_Number "$6")} {(terminal)} {(pipe)} ] redirects: [ (Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Number "$4")} spids:[150]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[154]) (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[157]) ] ) (SimpleCommand words: [ {($ VSub_Number "$1")} {($ VSub_Number "$2")} {($ VSub_Number "$3")} {($ VSub_Number "$6")} {(terminal)} {(terminal)} ] redirects: [ (Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Number "$4")} spids:[173]) (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[177]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[181]) ] ) ] )