2005/03/03

Detailed Linux Boot Process

Linux boot process is based, among others, on the System-V filed structure. Can read more on this article.

http://www.ccoss.org/tutorials/lfs/Linux_from_Scratch_A_Tour.htm

Fedora boot process, in more detail:

http://openskills.info/infobox.php?ID=228

2005/02/16

High leveling common tools

Tools like bash worths a "man bash" reading. You can even make recursive scripts! Lets play...
#!/bin/bash

function generalista ()
{
if [ $1 == "0" ] || [ $1 == "1" ]
then
echo 1
else
VARF=$(($1-1))
echo $VARF
generalista $VARF
fi
}

if [ "$#" == "1" ]
then
if [ $1 -ge 0 ]
then
time LISTA=$(generalista $1)
echo El factorial es el producto de los factores de esta lista : $LISTA
FACTORIAL=1;
for FACTOR in $LISTA
do
TEMP=$(($FACTORIAL*$FACTOR))
FACTORIAL=$TEMP
done
echo Entonces, el factorial de $1 es $FACTORIAL, aunque eso no es correcto...
else
echo Error: integer MUST be positive
fi
else
echo Usage: $0 positive_integer
fi

2005/01/07

Bash humor quotes database aids

#!/bin/bash

FORTFILE=/home/rodolfoap/bin/fortunes.mine
EDITOR=vi

HLPTXT=$(cat <<EOT
GNU fortunes is a personal fortunes engine organizer, written in bash.

Usage: fortunes [OPTION]

Options:
-e edit fortunes file
-l enters learning mode
-m enters multiline-learning mode
--help shows this help
--version shows version

Examples:

fortunes --help shows this help
fortunes -e edits fortunes file
fortunes generates a random fortune
fortunes -l starts learning mode

Report bugs to rodolfoap@hotmail.com
EOT)

VERTXT=$(cat <<EOT
GNU fortunes v0.1

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by Rodolfo Alcazar
EOT)

case "$1" in
"")
fortune $FORTFILE
;;
"-e")
$EDITOR $FORTFILE
/usr/sbin/strfile $FORTFILE
echo
;;
"-l")
echo "Entering learning mode."
echo
read -p "> " QUE
echo -e "$QUE\n%" >> $FORTFILE
echo
/usr/sbin/strfile $FORTFILE
;;
"-m")
echo "Entering multiline learning mode. End questions and answers with ^D."
echo
echo -n "> "
QUE=$(cat)
echo -e "$QUE\n%" >> $FORTFILE
echo
/usr/sbin/strfile $FORTFILE
;;
"-h"|"--help")
echo "$HLPTXT"
;;
"-v"|"--version")
echo "$VERTXT"
;;
esac



Fun, hah? With this basics I've wrote a flashcards studying tool. Drop me a line if you want it. Even better, you can write your own!