pdfextract

Extraire un intervalle de page d'un pdf - retour accueil

git clone git://bebou.netlib.re/pdfextract
Log | Files | Refs | README |

commit 60fa5918267950095086c832c3ada2368bdd1918
parent 83a563f9a267b7ecd407a64b4609db4ca1665543
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Tue, 26 Nov 2024 20:26:29 +0100

[] && [] mieux que [ -a ]

Voir la partie "Application usage" de la commande test dans le manuel
POSIX :

APPLICATION USAGE
       The XSI extensions specifying the -a and  -o  binary  pri‐
       maries  and the '(' and ')' operators have been marked ob‐
       solescent. (Many expressions using  them  are  ambiguously
       defined  by  the grammar depending on the specific expres‐
       sions being evaluated.) Scripts  using  these  expressions
       should  be converted to the forms given below. Even though
       many implementations will continue to support these  obso‐
       lescent  forms,  scripts  should be extremely careful when
       dealing with user-supplied input that  could  be  confused
       with  these  and other primaries and operators. Unless the
       application developer knows all the cases that produce in‐
       put to the script, invocations like:

           test "$1" -a "$2"

       should be written as:

           test "$1" && test "$2"

       to avoid problems if a user supplied values such as $1 set
       to '!'  and $2 set to the null string. That is,  in  cases
       where maximal portability is of concern, replace:

           test expr1 -a expr2

       with:

           test expr1 && test expr2

       and replace:

           test expr1 -o expr2

Diffstat:
Mpdfextract.sh | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pdfextract.sh b/pdfextract.sh @@ -33,8 +33,8 @@ nbpages() { pdfinfo "$sourcefile" | awk '{print $2}' } -[ -n "$s" -a -z "$e" ] && e="$(nbpages $f)" -[ -z "$s" -a -z "$e" ] && _die "Manque les pages" +[ -n "$s" ] && [ -z "$e" ] && e="$(nbpages $f)" +[ -z "$s" ] && [ -z "$e" ] && _die "Manque les pages" [ -z "$f" ] && _die "Manque le fichier source" tmpdir=$(mktemp -d)