[pocket-linux] some discrepancies in 6.3.4, 6.3.5?

Gary Singleton gsinglet1 at yahoo.com
Sat Feb 12 09:40:30 CST 2005


--- David Horton <dhorton at speakeasy.net> wrote:

> rainer wrote:
> 
> > hello,
> >
> > tried to send this problem on thursday from pine but it hasn't
> seemed 
> > to have arrived, please excuse the repeat if it does!
> >
> > i was continuing with ch. 6 when i noticed a few possible 
> > discrepancies (?);
> >
> > in 6.3.4 for the init.d/rc script we have,
> >
> > # Execute the kill scripts first.
> >  for SCRIPT in $SCRIPT_DIR/K*; do
> >    if [ -x "$SCRIPT" ]; then
> >      $SCRIPT stop;
> >    fi;
> >  done;
> > #
> > # Do the Start scripts last.
> >  for SCRIPT in $SCRIPT_DIR/S*; do
> >    if [ -x $SCRIPT ]; then
> >      $SCRIPT start;
> >    fi;
> >  done;
> >
> > inside the square brackets we have "$SCRIPT" in kill and $SCRIPT in
> 
> > start.
> > is this intentional?
> >
> > in 6.3.5 in the modified local_fs script we have,
> >
> >
> > start)
> >  echo "Checking local filesystem integrity."
> >  fsck -ATCp
> >  if [ $(($?)) -gt $((1)) ]; then
> >
> > but the original local_fs from 5.3.7 has
> >
> >
> > fsck -ATCp
> > if [ $? -gt 1 ]; then
> >
> > my understanding is this part didn't need any modification in the 
> > updated script, again is this intentional?
> >
> >
> > thanks
> 
> 
> These are both unintentional typos.  Neither one will break anything,
> 
> but you're right that it does look confusing.
> 
> [ -x $SCRIPT ]; and [ -x "$SCRIPT" ]; are essentially the same, but 
> using the double quotes explicitly tells BASH to expand any
> characters 
> like * ? or ~ into filenames.  It's probably best to use the double 
> quotes and not rely on BASH to guess if it should expand or not.
> 
> [ $(($?)) -gt $((1)) ]; and [ $? -gt 1 ]; are the same, but the
> former 
> is much more confusing to look at.  The $(( )) notation tells BASH to
> 
> treat what is in the parentheses as a numerical value.  However this
> is 
> redundant because -gt (greater than) is a numerical operator and
> using 
> it implies that we are dealing with numbers.  So it is best to use
> the 
> easier to read [ $? -gt 1 ]; format.
> 
> If you want to gain some more insight into the notation the BASH
> manpage 
> has more detailed descriptions.  There are also some manpages for the
> 
> original Bourne shell that are much more concise.  You can find these
> on 
> the web or on an older, non-Linux, Unix box.  When searching it is 
> important to note that many times the Bourne shell is called bsh
> instead 
> of just sh.

Along the lines of older and/or simpler Unix like OSs you can also
still play with MINIX and see what inspired Linus to write Linux. I
think the primary shell is ash rather than an older sh but it may still
be something to look at. I've been running MINIX on QEMU (an emulator)
and have found it interesting.

MINIX:
http://www.cs.vu.nl/~ast/minix.html
http://www.cs.vu.nl/pub/minix/
http://minix1.hampshire.edu/
http://www.minix-vmd.org/

QEMU:
http://fabrice.bellard.free.fr/qemu/




More information about the Pocket-Linux mailing list