[LTP] test.sh and ROD redirection

Cyril Hrubis chrubis@suse.cz
Mon Jan 25 17:41:29 CET 2016


Hi!
> > +	for arg; do
> > +		if [ "$arg" == ">" ]; then
> 
> I would change it to
>          if [ "${arg:0:1}" == ">" ]; then
>                  arg=${arg:1}

That does work only in bash.

The easiest portable way I can come up with is:

	if [ "${arg#\>}" != "$arg" ]; then
		arg=${arg#\>}
	fi

> > +			flag=1
> > +			continue
> May be break here, so we don't need the next if block.

Right.

> > +		fi
> > +
> > +		if [ -n "$flag" ]; then
> > +			break
> > +		fi
> > +		cmd="$cmd $arg"
> 
> But what if the rest of args has something else, e.g. 2>&1 ?

Hmm, we can look for that in the $@ as well but nobody is using ROD with
that at the moment. We can think about this later ideally when there is
need for this.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the Ltp mailing list