bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash


From: Marcus Brinkmann
Subject: Re: [PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash.
Date: Fri, 4 Jan 2002 01:49:03 +0100
User-agent: Mutt/1.3.24i

On Fri, Jan 04, 2002 at 01:18:50AM +0100, Alfred M. Szmidt wrote:
> I changed it back to the original version but modified it a bit so it
> works under a POSIX shell.  Currently its a really ugly hack, so if
> you have any suggestions on how one could do it differently please
> tell me.

Before you break your head over trying to understand why the code works,
here are a few notes (if you are training for the obfuscated shell contest,
don't read on):

The -c option makes sure all nodes exist, even if the glob is failing.  So
you might end up with empty files like '*' or '.??*'.

local variables are not supported by POSIX.  We get away with using a
recursive function anyway because it is mostly tail recursive.  The only
problem is the "rmdir $f", which comes after the recursion and uses a local
variable.  The dirname $f makes up for this case, because the only thing
that happens after the recursion is that $f has a path element more than
before.

It is black magic, but it seems to work :)

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]