Auto-éditer un wikilivre/Annexer (Version internationalisée)/textman.sh
Apparence
#!/bin/bash
#H File: textman.sh
#H syntax: textman.sh <manual>
#H Example: textman.sh annex
VERSION=211122
#O If first param is empty print version and syntax
if test -z $1
then
echo "textman.sh version $VERSION"
echo "Usage: textman <manual> or ./textman.sh <manual>"
exit -1
fi
#O Include install variables
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
#O Download global variables
source $Workdir/vars/installdir.var
if test -z $$Mandir
then Mandir=$Installdir/man
fi
if test -z $Sbindir
then Sbindir=$Installdir/sbin
fi
#O find lang
#es
if echo $LANG | grep es
then
Mylang=es
echo "Mi idioma retenido es '$Mylang' "
echo "Puedes escribir 'alias textman=\"$Sbindir/textman\"' en una consola "
#fr
elif echo $LANG | grep fr
then Mylang=fr
echo "Ma langue retenue est '$Mylang' "
echo "Vous pouvez taper 'alias textman=\"$Sbindir/textman\"' dans une console"
#en
else
if echo $LANG | grep en
then Mylang=en
echo "My retained language is '$Mylang' "
echo "You can type 'alias textman=\"$Sbindir/textman\"' in a terminal"
fi
fi
#O If manual exist in Mylang
if test -e "$Mandir/$Mylang/man1/$1.txt"
then
echo "$Mandir/$Mylang/man1/$1.txt exist"
yelp man:$Mandir/$Mylang/man1/$1.txt&
elif test -s $Mandir/man1/$1.txt
then
echo "$Mandir/man1/$1.txt exist"
yelp man:$Mandir/man1/$1.txt&
else
echo "$1.txt is not found in user man pages. Attempt in the general manual"
man /usr/share/man/man1/$1.1.gz > $1.txt
yelp ./$1.txt&
sleep 1
rm $1.txt
#yelp man:$1.1.gz& #Version
fi
#O End of textman