From 0903cf41a11cc5bf6795d39620aa0f774ff10223 Mon Sep 17 00:00:00 2001 From: zawz Date: Fri, 4 Feb 2022 16:50:44 +0100 Subject: [PATCH] chore(debashify): debashify procsub in redirects --- src/debashify.cpp | 8 ++++++++ test/debashify.bash | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/debashify.cpp b/src/debashify.cpp index c1c8632..29a7bb8 100644 --- a/src/debashify.cpp +++ b/src/debashify.cpp @@ -782,6 +782,14 @@ bool debashify_procsub(list_t* lst, debashify_params* params) } } } + for(auto reit: cmit->redirs) { + arg_t* ait=reit->target; + if(ait != nullptr && ait->size() == 1 && ait->sa[0]->type == _obj::subarg_procsub) + { + subarg_procsub_t* st = dynamic_cast(ait->sa[0]); + affected_args.push_back( std::make_pair(ait, st->is_output) ); + } + } } } // perform the replace diff --git a/test/debashify.bash b/test/debashify.bash index 0088c88..06d5e09 100644 --- a/test/debashify.bash +++ b/test/debashify.bash @@ -44,3 +44,7 @@ echo ${TITI:-bar} TATA=TOTO echo ${!TATA} + +for I in A B C ; do + echo "$I" +done > >(grep A)