On Jun  9, 2011, Lawrence Crowl <cr...@google.com> wrote:

> On 6/9/11, Diego Novillo <dnovi...@google.com> wrote:
>> +args="$@"

I'd keep args in "$@" and use "$@" instead of $args, so as to avoid
quoting issues.

>> +line=$(grep "^spawn .*$pattern" $logf | sed -e "s:^spawn ::")

> line=$(sed -e "/^spawn .*$pattern/ ! d ; s/^spawn //" $logf)

> Has one fewer process and one fewer pipe.  Sed is your friend.

I'd have written sed -n "s/^spawn \(.*$pattern\)/\1/p", but I'm not sure
it's more efficient.

It would be wise to first quote slashes in the pattern:

pattern=`echo "$pattern" | sed 's:/:\\/:g'`

>> +if [ "$line" = "" ] ; then

[ -z "$line" ]

Thanks, Diego,

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Reply via email to