[Bug 35] rc and rcS file may need updating
nomis80 at videotron.ca
Fri May 11 19:28:21 PDT 2001
On Friday 11 May 2001 20:40, you wrote:
> The [0-9][0-9][0-9] are only used to construct the
> sysinit_start, previous_start and previous_stop variables. The actual
> running of the script is just $i stop or $i start that's constructed
> from a "for in S*" or "for in in K*" and it lets bash sort the scripts
> in numeric order.
I believe that that way of sorting is very wrong. What we want is to be able
(ideally) to have links of this form:
This being a regex meaning: either S or K to begin, followed by one or more
digit, followed by one or more alphanumeric character (given that numbers
can't be the of that group, since they'd be taken as the order number).
S\d\d\d (\d meaning digit, shorter to write) was enforcing some sort of
number format. For example, if you wanted to give number 20 to a link, you
had to put 020, since rc (or rcS, for that matter) only looked for this
format of symlink. This way, letting bash sort them lexically in a for loop
was a good thing since 020 always comes before 100.
But now S* matches anything, so you could write your symlink as S20script and
this one would come before S100script, since it is lexically higher. Bash's
for loops do not sort numerically (and even if they did, they couldn't,
because S is the first character), so we need to fix that up. There are two
solutions, because we clearly can't keep the S* pattern:
1) We could enforce S\d\d\d\w+ by simply using "for i in
./S[0-9][0-9][0-9]*", and let bash run them in lexical order, which, in this
case, would correspond to numerical order.
2) We could hack the scripts so that they accept the S\d+\w+ pattern.
> Let's run a test. The old way:
> gerard:/etc/rcS.d$ for i in S??*; do echo $i; done
> The new way:
> gerard:/etc/rcS.d$ for i in S*; do echo $i; done
This is all nice unless you somehow decide to use two numbers instead of
three, for example. The script does not enforce three numbers only, as
Simon Perreault -- Public key: http://nomis80.linuxfromscratch.org/nomis80.gpg
More information about the lfs-book