list.sh.
VERSION=210523
 . gettext.sh
 if test -e ~/Add_appendix/bin/header.inc; then source ~/Add_appendix/bin/header.inc
 else echo "$Bindir/header.inc not found. Execute sbin/cp-src2bin.sh"; exit -1
 fi
 SitePrefix=https:\/\/$Site\/wiki\/
 if test -e "$Projectdir/$1.compiled"
 then 
 echo "$(gettext ' Found Compiled page : ')$Project/$1.compiled"; echo
 echo " create $Projectdir/$1.list with :"; echo " $Projectdir/$1.compiled"; echo
 cat "$Projectdir/$1.compiled" | sed -f ~/Add_appendix/datas/content_cleaner.dat > $Projectdir/$1.compiled.cleaned
 cat "$Projectdir/$1.compiled.cleaned" | grep -v '=' | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' | cut -d '|' -f1 > $Projectdir/$1.list
 cat "$Projectdir/$1.compiled.cleaned" | grep -v '=' | sed "s/\[\| sed "s/\\]//g" | cut -d '|' -f1 > $Projectdir/$1.prj
 elif test -e "$Projectdir/$1.contents"
 then 
 echo "$(gettext ' Found contents page : ')$Projectdir/$1.contents"; echo
 echo " create $Projectdir/$1.list with :"; echo " $Projectdir/$1.contents"; echo
 echo "$Bookfullurl" > $Project/$1.list
 echo " Do not use in Contents page"
 cat "$Projectdir/$1.contents" | sed -f ~/Add_appendix/datas/content_cleaner.dat > $Projectdir/$1.contents.cleaned
 cat "$Projectdir/$1.contents.cleaned" | grep -v '=' | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' | cut -d '|' -f1 > $Projectdir/$1.list
 cat "$Projectdir/$1.contents.cleaned" | grep -v '=' | sed "s/\[\| sed "s/\\]//g" | cut -d '|' -f1 > $Projectdir/$1.prj
 elif test -e "$Workdir/books/$1/$1.summary"
 then
 Projets=$Workdir/books
 echo "$(gettext ' Found Summary page : ')"$Projets/$1/$1.summary; echo
 echo " create $Projets/$1/$1.list with :"; echo " $Projets/$1/$1.summary"; echo
 echo "$Bookfullurl" > $Projets/$1/$1.list
 echo " Do not use in Summary page"
 cat "$Projets/$1/$1.summary" | sed -f ~/Add_appendix/datas/content_cleaner.dat > "$Projets/$1/$1".summary.cleaned
 cat "$Projets/$1/$1.summary.cleaned" | grep -v '=' | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' | cut -d '|' -f1 » $Projets/$1/$1.list
 cat "$Projets/$1/$1.summary.cleaned" | grep -v '=' | sed "s/\[\| sed "s/\\]//g" | cut -d '|' -f1 > "$Projets/$1/$1".prj
 #else echo "bookname.suffix : $1.$Suffix not found"
 fi
 echo
 echo "$(gettext ' File Project.list')"
 cat $Workdir/books/$1/$1.list
 echo
 echo "$(gettext ' File Project.prj')"
 cat $Workdir/books/$1/$1.prj
 echo " "
 read -p "If all OK : return to continue, Ctrl-C to quit > "
tests_list.bash.
VERSION=210522
 clear
 pwd > pwd.txt
 if cat pwd.txt | grep ~/Annexer; then Workdir=~/Annexer; elif cat pwd.txt | grep ~/Add_appendix; \
 then Workdir=~/Add_appendix; else echo "Workind directory not found"; exit -1;fi
 rm pwd.txt 
 source $Workdir/vars/installdir.var
 echo " test_list.bash version = $VERSION"
 sleep 2
 echo -e "\033[1;33m Control list.sh in the local test directory \033[0m" > text-control.txt 
 echo -e "\033[1;33m Please check that the comment line does not contain an command \033[0m" » text-control.txt
 echo -e "\033[1;33m ---- \033[0m"
 grep -n -e "#T\|#O\|#P" list.sh » text-control.txt
 more text-control.txt
 echo; echo -e "\033[47m\033[1;30m Continue ? \033[0m"
 read -s -e -n 1 -t 60 -p "y/n ? : " Inkey;echo
 if [ "$Inkey" != 'y' ]; then echo " Inkey is not yes, or time out after 60 sec, exit from $0"; exit 0;fi
 echo "Command ./list.sh - --t to verify environnement variables"
 echo " in test mode with first param empty"
 ./list.sh - --t
 echo;echo " wait for 2 sec"
 sleep 5; echo "----"
 echo "Command ./list.sh without parameter"
 ./list.sh
 echo;echo " wait for 2 sec"
 sleep 2; echo "----"
 echo " All tests whith parameter --t" 
 Inkey=1
 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 ./list.sh LivreTest --t
 elif [ "$Inkey" = "2" ]; then ./list.sh Hélices_de_navires_à_déplacement --t
 elif [ "$Inkey" = "3" ]; then ./list.sh TestBook --t
 elif [ "$Inkey" = "4" ]; then ./list.sh Mkd_\(Extracteur_de_documents\) --t
 elif [ "$Inkey" = "5" ]; then ./list.sh Faire_fleurir_le_sel --t
 elif [ "$Inkey" = "6" ]; then ./list.sh Faire_sa_fleur_de_sel --t 
 elif [ "$Inkey" = "7" ]; then ./list.sh Guide_to_Unix --t
 elif [ "$Inkey" = "8" ]; then ./list.sh Tests_de_la_capacité_des_batteries_d%27accumulateurs
 elif [ "$Inkey" = "9" ]; then ./list.sh LivreTest --t
 else echo "$inkey local url of site not found"; exit 0
 fi
 done
content_cleaner.dat.
Ce fichier supprime l'espace après ';' et ": ", ':', "* ", '*' "# ", '#' devant la parenthèse '['
S'utilise de la façon suivante :
echo "Chaîne de caractères" | sed -f $Datasdir/content_cleaner.dat 
ou :
cat "$Bookname.$Suffix" | sed -f $Datasdir/content_cleaner.dat > "$Bookname.$Suffix.cleaned"

Auto-éditer un wikilivre/install annex.sh

Version=200321
 echo "Version of install_annex.sh "$Version
 if [ "$1" = "?" ]; then echo "Syntax : ./install_annex.sh [ <Install directory> || ? ]"; exit 0; fi
 if [ -z $1 ]; then echo "Syntax ./install_annex.sh [ ? | Add_appendix | Annexer | /usr/local | /usr ]"; exit 0; fi
 cd
 echo""; echo -n "current directory = "; pwd; echo ""
 if [ $1 ];
 then 
 if [ $1 = "/usr" ]; then Installdir=$1; echo "Installdir = /usr";
 elif [ $1 = "/usr/local" ]; then Installdir=$1; echo "Installdir = /usr/local";
 elif [ $1 = "Annexer" ]; then Installdir=~/Annexer; echo "Installdir = "$Installdir
 elif [ $1 = "Add_appendix" ]; then Installdir=~/Add_appendix; echo "Installdir = "$Installdir
 fi
 fi
 if [ -d $Installdir ];
 then echo " is ok, $Installdir is present." 
 else echo " $Installdir not exist, i create it"; mkdir $Installdir;
 fi 
 if [ $1 = "Add_appendix" ] && [ $1 != "Annexer" ]; then Workdir=~/Add_appendix; echo "Workdir = "$Workdir; fi
 if [ $1 = "Annexer" ] && [ $1 != "Add_appendix" ]; then Workdir=~/Annexer; echo "Workdir = "$Workdir; fi
 if [ $1 = "/usr" ] || [ $1 = "/usr/local" ]; then Workdir=~/Add_appendix; echo "Workdir = "$Workdir; fi 
 if [ -d $Workdir ]; then echo " $Workdir is present."; else echo " $Workdir is not present, i create it."; mkdir $Workdir; fi
 Bindir="$Installdir/bin"; echo "Bindir : "$Bindir; 
 if test -d $Bindir; 
 then echo " is ok."; 
 else echo " not present, create it"; mkdir $Installdir; 
 fi
 Testdir=$Installdir/sbin; echo "Units-Tests-dir for commands and translations = Testdir = "$Testdir; 
 if test -d $Testdir; 
 then echo " is ok."; 
 else echo " is not present, create it"; mkdir $Testdir;
 fi
 cd $Installdir 
 echo -n "The current directory to create $Installdir sub directories = "; pwd
 mkdir -p datas resources src
 cd share
 echo "Share is the current directory to create sub share directories."; pwd
exit 0
 cd
 echo""; echo -n "current directory = "; pwd; echo ""
 if [ test -a $Installdir/src/annex.sh ];
 then echo " annex.sh is OK in src directory $Installdir/src";
 else 
 echo " annex.sh not found in src directory $Installdir/src";
 echo " Please copy all annex internationalized files in $Installdir/src directory";
 exit -1;
 fi
 rm -r ./tmp; rm ./tmpfiles
 mkdir ./tmp 
 ls $Installdir/src/*.sh > ./tmp/shell_files.prj
 while read line
 do
 echo $line | awk -F "/" '{print $NF}' > tmpfile
 read file < tmpfile
 cat $line | grep -v '#' > $Testdir/$file
 done < ./tmp/shell_files.prj
 rm ./tmpfile
 #rm -r ./tmp
 xgettext -L shell -o $Installdir/share/locale/en/header.inc.pot --from-code=UTF-8 $Testdir/header.inc#.sh
 xgettext -L shell -o $Installdir/share/locale/en/annex.pot --from-code=UTF-8 $Testdir/annex#.sh
 echo "-----"
 echo "Tasks to be accomplished :"
 echo "Modify these files as functions"
 echo "Integrate these functions in the librairie $Installdir/lib/annex.lib"
exit 0

Jardinage/Calendrier/Mois
Auto-éditer un wikilivre/Annexer (Version internationalisée)/cp-src2bin.sh