From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] test.sh and ROD redirection
Date: Mon, 25 Jan 2016 18:18:27 +0100 [thread overview]
Message-ID: <20160125171827.GB2763@rei.lan> (raw)
In-Reply-To: <56A64CCE.8040306@oracle.com>
Hi!
> > + flag=1
> > + continue
> May be break here, so we don't need the next if block.
We have to do another loop just to fetch the parameter after the \> if
there is space between \> and path. So the continue should stay.
Full version then would be:
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -214,7 +214,35 @@ ROD_SILENT()
ROD()
{
- $@
+ local cmd
+ local arg
+ local file
+ local flag
+
+ for arg; do
+ file="${arg#\>}"
+ if [ "$file" != "$arg" ]; then
+ if [ -n "$file" ]; then
+ break
+ fi
+ flag=1
+ continue
+ fi
+
+ if [ -n "$flag" ]; then
+ file="$arg"
+ break
+ fi
+
+ cmd="$cmd $arg"
+ done
+
+ if [ -n "$file" ]; then
+ $cmd > $file
+ else
+ $@
+ fi
+
if [ $? -ne 0 ]; then
tst_brkm TBROK "$@ failed"
fi
This works both with:
ROD echo a \> file
ROD echo a \>file
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-01-25 17:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-21 13:51 [LTP] test.sh and ROD redirection Cyril Hrubis
2016-01-22 9:15 ` Alexey Kodanev
2016-01-25 11:16 ` Cyril Hrubis
2016-01-25 13:45 ` Cyril Hrubis
2016-01-25 16:26 ` Alexey Kodanev
2016-01-25 16:41 ` Cyril Hrubis
2016-01-25 17:18 ` Cyril Hrubis [this message]
2016-01-25 17:51 ` Alexey Kodanev
2016-01-25 18:07 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160125171827.GB2763@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox