Annex.sh.
. gettext.sh
 VERSION=211004
 if [ "$1" = "--v" ]; then echo "Annex version $VERSION"; exit 0; echo; fi
 TEXTDOMAIN=annex
 TEXTDOMAINDIR="/usr/share/locale"
 if [ -z $1 ]
 then
 echo "$(gettext ' No Parameter ')"
 echo "$(gettext ' Syntax : annex [ <book/contents url> | <Collections/book url> | ? ] [ -v ] [ -pb | -pc ] ')"; 
 exit 0;
 fi 
 if [ "$1" = "?" ]
 then 
 clear
 echo "$(gettext ' Syntax : ')"
 echo "$(gettext ' annex [ <book/contents url> | <collections/book url> | ? ] [ -v ] [ -pb | -pc ] ')"
 echo "$(gettext ' Options : ')"
 echo "$(gettext ' annex ?, to display the command syntax. ')"
 echo "$(gettext ' -pb for personal version with illustrations on Wikibooks. ')"
 echo "$(gettext ' -pc for personal version with illustrations on Commons. ')"
 echo "$(gettext ' -v verbose mode. ')"
 exit 0
 fi
 if [ -e $Workdir/vars/installdir.var ]; 
 then 
 source $Workdir/vars/installdir.var
 echo "$Workdir/vars/installdir.var is found in annex command"; echo
 Bindir=$Installdir/bin
 Testsdir=$Workdir/tests
 else
 echo -n "current directory in $0 "
 pwd
 echo "$Workdir/vars/installdir.var not found in $0 command"
 exit -1
 fi
echo "Install directory = $Installdir"
echo "Working directory = $Workdir"
echo "Bin directory = $Bindir"
echo "Tests directory = $Testsdir"
 if test -e "$Bindir/header.inc"
 then
 echo "header.inc found in $Bindir"
 source $Bindir/header.inc
 else echo "copy header.inc to $Bindir to continue"; exit -1
 fi
 echo "*** 'annex' command ***"
 #T echo "Installdir : "$Installdir
 Verbose="false"
 Personal="false"
 Personalwb="false"
 Personalco="false" 
 if (("$#" > "1")) 
 then
 if [ "$2" = "-v" ]
 then
 Verbose="true";
 fi
 if [ "$2" = "-pb" ]
 then
 Personalwb="true"; Personal="true";
 fi
 if [ "$2" = "-pc" ]
 then
 Personalco="true"; Personal="true";
 fi
 fi
 if (("$#" == "3"))
 then
 if [ "$3" = "-v" ]
 then
 Verbose="true";
 fi
 if [ "$3" = "-pb" ]
 then 
 if test "$Personalco" = "false" 
 then 
 Personalwb="true"; Personal="true" 
 else 
 echo "$(gettext ' -annex- Error at command line, parameter three :$3 incompatible with parameter two :$2 ')" 
 exit 1 
 fi;
 fi
 if [ "$3" = "-pc" ]
 then if test "$Personalwb" = "false"; then Personalco="true"; Personal="true"; 
 else echo "$(gettext ' Error at command line, parameter three :$3 incompatible with parameter two :$2 ')"; exit 1; fi;
 fi
 fi
 if (("$#" > "3")) 
 then 
 echo "$(gettext ' -annex- Error : too many parameters ! ')"
 echo "$(gettext ' ./annex ? to display the syntax. ')"
 exit 1
 fi
 echo "$(gettext ' The variable Verbose is initialised at : ')"$Verbose
 echo "$(gettext ' The variable Personalwb is initialised at : ')"$Personalwb
 echo "$(gettext ' The variable Personalco is initialised at : ')"$Personalco
 echo "$(gettext ' The variable Personal is initialised at : ')"$Personal
 echo ""
 echo "$(gettext ' -Command annex- Files in project directory : ')"
 ls $Projectdir
 echo "$(gettext ' Delete in the project directory : *.html *.str *.img *.lnk tmp temp *.tmp *.temp *.list ? ')"
 echo -e "$(gettext ' \033[31m 'y' to approve the deletion. \033[0m ')" 
 echo "$(gettext ' Return to continue, Ctrl-C to exit. ')"
 read -n1 -p -s Inkey
 echo "$(gettext ' Inkey = ')"$Inkey
 if [ "$Inkey" = "y" ]
 then 
 cd $Projectdir
 echo -e "$(gettext ' \033[31mDeleting files.\033[0m ')"
 rm -R *.html *.str *.img *.lnk tmp temp *.tmp *.temp *.list
 else echo "$(gettext ' No file deletion ! ... Continue ... ')"
 fi
 echo "WAIT ..."
 if test -d $Workdir/temp/Report-verbose-mode; then rm $Workdir/temp/Report-verbose-mode/*.txt; echo -n "" ; else mkdir $Workdir/temp//Report-verbose-mode; fi;
 if test -d $Workdir/temp/Report-silent-mode; then rm $Workdir/temp/Report-silent-mode/*.txt; echo -n "" ; else mkdir $Workdir/temp/Report-silent-mode; fi;
 if [ $Verbose = "true" ]
 then $Bindir/list $1
 else $Bindir/list $1 > $Workdir/temp/Report-silent-mode/list-cmd.txt
 fi 
 Return=$?
 if [ $Return -gt '0' ]
 then
 echo "$(gettext ' Error in shell module list in silent mode. See $Workdir/temp/Report-silent-mode/list-cmd.txt ')"
 exit 1
 fi
 if [ $Verbose = "true" ]
 then $Bindir/download $1
 else $Bindir/download $1 > $Workdir/temp/Report-silent-mode/download-cmd.txt 
 fi 
 Return=$?
 if [ $Return -gt '0' ]
 then
 echo "$(gettext ' Error in shell module download in silent mode. See $Workdir/temp/Report-silent-mode/download-cmd.txt ')"
 exit 1
 fi
 if [ $Verbose = "true" ]
 then 
 $Bindir/add_sclt $1
 else
 $Bindir/add_sclt $1 > $Workdir/temp/Report-silent-mode/add_sclt-cmd.txt
 fi 
 Return=$?
 if [ $Return -gt '0' ]
 then
 echo "$(gettext ' Error in shell module add-sclt in silent mode. See $Workdir/temp/Report-silent-mode/add_sclt-cmd.txt ')"
 exit 1
 fi
 if [ $Personal = "false" ]
 then
 if [ $Verbose = "true" ]
 then
 $Bindir/add_sclic $1
 else
 $Bindir/add_sclic $1 > $Workdir/temp/Report-silent-mode/add_sclic-cmd.txt
 fi 
 cat $Projectdir/$1.sclic > $Projectdir/$1.scli
 fi
 Return=$?
 if [ $Return -gt '0' ] && [ $Personal = "false" ];
 then
 echo "$(gettext ' Error in shell module add_sclic in silent mode. See $Workdir/temp/Report-silent-mode/add_sclic-cmd.txt ')"
 exit 1
 fi 
 if [ "$Personalco" = "true" ]
 then
 if [ "$Verbose" = "true" ]; then $Bindir/add_sclipco $1; else $Bindir/add_sclipco $1 > $Workdir/temp/Report-silent-mode/add_sclipco-cmd.txt; fi;
 echo "$(gettext ' sclipco has been executed ')";
 fi
 Return=$?
 if [ $Return -gt '0' ] && [ $Personalpc = "true" ];
 then
 echo "$(gettext ' Error in shell module slipco. See $Workdir/temp/Report-silent-mode/sclipco-cmd.txt ')"
 exit 1
 fi 
 if [ "$Personalwb" = "true" ]
 then
 if [ "$Verbose" = "true" ]; then $Bindir/add_sclipwb $1; else $Bindir/add_sclipwb $1 > $Workdir/temp/Report-silent-mode/add_scliwb-cmd.txt; fi;
 echo "$(gettext ' sclipwb has been executed ')";
 fi
 if [ $Return -gt '0' ] && [ $Personalwb = "true" ];
 then
 echo "$(gettext ' Error in shell module slipwb. See $Workdir/temp/Report-silent-mode/scliwb-cmd.txt ')"
 exit 1
 fi 
 cd $Projectdir
 cat $1.sclt > $1.appendix
 if [ $Personalwb = "true" ]
 then cat $Projectdir/$1.sclipwb » $Projectdir/$1.appendix; echo "$(gettext ' $1.sclipwb is added to $1.appendix ')";
 elif [ $Personalco = "true" ]
 then cat $Projectdir/$1.sclipco » $Projectdir/$1.appendix; echo "$(gettext ' $1.sclipco is added to $1.appendix ')";
 else
 cat $Projectdir/$1.sclic » $Projectdir/$1.appendix; echo "$(gettext ' $1.sclic is added to $1.appendix ')";
 fi
 echo "$(gettext '== License == ')" » $Projectdir/$1.appendix
 cat $Projectdir/$1/$1.license » $Projectdir/$1.appendix
 echo "" » $Projectdir/$1.appendix
 #P echo "" » $Projectdir/$1.appendix
 #P echo "$(gettext ' ')"" on en:wikibooks » $Projectdir/$1.appendix
 echo "<br style=\"page-break-after: always\">" » $Projectdir/$1.appendix
echo ""
echo ""
echo ""
echo -n "$(gettext ' Copy the contents of the file ')"$Projectdir/$1.appendix
echo "$(gettext ' to the Appendix page of the book ')"$1.
exit 0
Global test.
clear
VERSION=210822
echo "test_annex.bash VERSION = $VERSION"
Workdir=~/Add_appendix
./annex.sh --v
echo;echo " wait for 2 sec"
sleep 2
./annex.sh
echo;echo " wait for 2 sec"
sleep 2
clear
./annex.sh ?
echo;echo " wait for 5 sec"
sleep 3
clear
 Inkey=1
 cat $Workdir/tests/sitelist.txt; echo
 for i in 'seq 1 9'
 do 
 #cat $Workdir/tests/sitelist.txt; echo
 echo -e "\033[47m\033[1;30m Choose the site number to test \033[0m"
 read -s -n1 -p "inkey number 1 to 9 : " Inkey; echo;
 if [ "$Inkey" = "1" ]; then ./annex.sh LivreTest; ./annex.sh LivreTest -v -pc; ./annex.sh LivreTest -v -pb
 elif [ "$Inkey" = "2" ]; then ./annex.sh Hélices_de_navires_à_déplacement; ./annex.sh Hélices_de_navires_à_déplacement -v -pc; ./annex.sh Hélices_de_navires_à_déplacement -v -pb
 elif [ "$Inkey" = "3" ]; then ./annex.sh TestBook; ./annex.sh TestBook -v -pc; ./annex.sh TestBook-v -pb
 elif [ "$Inkey" = "4" ]; then ./annex.sh Mkd_\(Extracteur_de_documents\); ./annex.sh Mkd_\(Extracteur_de_documents\) -v -pc; ./annex.sh Mkd_\(Extracteur_de_documents\) -v -pb
 elif [ "$Inkey" = "5" ]; then ./annex.sh Faire_fleurir_le_sel; ./annex.sh Faire_fleurir_le_sel -v -pc; ./annex.sh Faire_fleurir_le_sel -v -pb
 elif [ "$Inkey" = "6" ]; then ./annex.sh Faire_sa_fleur_de_sel; ./annex.sh Faire_sa_fleur_de_sel -v -pc; ./annex.sh Faire_sa_fleur_de_sel -v -pb 
 elif [ "$Inkey" = "7" ]; then ./annex.sh Guide_to_Unix; ./annex.sh Guide_to_Unix -v -pc; ./annex.sh Guide_to_Unix -v -pb
 elif [ "$Inkey" = "8" ]; then ./annex.sh Tests_de_la_capacité_des_batteries_d%27accumulateurs; ./annex.sh Tests_de_la_capacité_des_batteries_d%27accumulateurs -v -pc; ./annex.sh Tests_de_la_capacité_des_batteries_d%27accumulateurs -v -pb
 elif [ "$Inkey" = "9" ]; then ./annex.sh LivreTest; ./annex.sh LivreTest -v -pc; ./annex.sh LivreTest -v -pb
 else echo "$inkey local url of site not found"; exit 0
 fi
 done