Version imprimable du sujet

Cliquez ici pour voir ce sujet dans son format original

Forums MacBidouille _ UNIX _ Utilitaire man UNIX

Écrit par : frankie00 15 Dec 2023, 17:28

Voici un utilitaire qui permet d'afficher la page man dans Aperçu donc on peut la consulter en entier et tranquillement
Vous l'appelez ce programme par exemple pman et vous le mettez sous /usr/local/bin en faisant bien sûr avant chmod +x pman


CODE

#!/bin/bash
# "$#" is number of parameters- here we test
# whether it is not equal to two

if [ $# -eq 0 ]; then
echo "Usage en cours: $0 <UNIX command> ..." # not two parameters
osascript -e "beep"
exit 2 # and fail ($0 is # name of command).
fi
(test -f /bin/$1) || (test -f /usr/bin/$1) || (test -f /usr/sbin/$1) || (test -f /sbin/$1) || (test -f /usr/local/bin/$1)
if [ "$?" -eq 1 ] ;then
echo -e " Commande \033[4m$1\033[0m non trouvée..."
say -v Audrey " Commande non trouvée"
sleep 1
osascript -e "beep"
exit 3
fi

man -t $1 | ps2pdf - $1.pdf
open -a /System/Applications/Preview.app $1.pdf

if [ "$?" -eq 0 ]; then
(sleep 60; rm -f $1.pdf) &

if [ "$?" -eq 0 ]; then

afplay /Users/....mp3
rm -f $1.pdf
fi
fi


Pour le corriger ou l'implémenter vous vous servez d'un éditeur non ASCII genre BBEdit

Propulsé par Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)