Auto-éditer un wikilivre/Annexer (Version internationalisée)/userman.sh
Apparence
#!/bin/bash
#H File: userman.sh
#H syntax: userman.sh <manual>
#H Example: userman.sh annex
VERSION=211122
#O If first param is empty print version and syntax
if test -z $1
then
echo "userman.sh version $VERSION"
echo "Usage: userman <manual> or ./userman.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 userman=\"$Sbindir/userman\"' en una consola "
#fr
elif echo $LANG | grep fr
then Mylang=fr
echo "Ma langue retenue est '$Mylang' "
echo "Vous pouvez taper 'alias userman=\"$Sbindir/userman\"' dans une console"
#en
else
if echo $LANG | grep en
then Mylang=en
echo "My retained language is '$Mylang' "
echo "You can type 'alias userman=\"$Sbindir/userman\"' in a terminal"
fi
fi
#O If manual exist in Mylang
if test -e "$Mandir/$Mylang/man1/$1.1.gz"
then
echo "$Mandir/$Mylang/man1/$1.1.gz exist"
yelp man:$Mandir/$Mylang/man1/$1.1.gz&
elif test -s $Mandir/man1/$1.1.gz
then
echo "$Mandir/man1/$1.1.gz exist"
yelp man:$Mandir/man1/$1.1.gz&
else
echo "$1.1.gz is not found in user man pages. Attempt in the general manual"
# Version texte pour gedit
if test -e /usr/share/man/man1/$1.1.gz
then
man /usr/share/man/man1/$1.1.gz > $1.txt; yelp $1.txt; rm $1.txt
else
echo "/usr/share/man/man1/$1.1.gz is not found"
fi
# Version console :
# man /usr/share/man/man1/$1.1.gz
# Versions aide
# yelp man:$1.1.gz&
# xdg-open "man:$1.1.gz&"
fi
#O End of userman