[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: slab consumption
On Tue, 2007-10-16 at 15:01 +0700, Mulyadi Santosa wrote:
> Hi...
> > [1] test script
> > #!/bin/sh
> >
> > [ ! -d /mnt/memtest ] && mkdir -p /mnt/memtest
> > while [ 1 ]; do
> > /sbin/ifconfig irda0 down
> > sleep 1
> > /sbin/ifconfig irda0 up
> > sleep 1
> I roughly think it because the shell fork new subshell in every "while"
> iteration. What if you do it like this instead:
> while [ 1 ];
> do (
> ...your commands..
>
> ; ) ;
> done
>
>
> That way, all commands will be executed under the same shell, not
> forking one continously.
>
A () compound will still be executed in a subshell.. {} will execute in the current shell:
while [ 1 ];
do {
command;
command;
};
done
-law
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ