Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | Prochaine révision Les deux révisions suivantes | ||
tutoriel:script_shell [Le 23/11/2020, 21:55] bcag2 ajout l'option 'bash' au balise <code> |
tutoriel:script_shell [Le 31/12/2020, 17:14] 84.101.133.79 [Introduction aux scripts shell] |
||
---|---|---|---|
Ligne 12: | Ligne 12: | ||
# Make a copy of the file | # Make a copy of the file | ||
- | cp $1 $2 | + | cp "$1" "$2" |
# Get the number of frames | # Get the number of frames | ||
- | numframes=`gifsicle $1 -I | grep -P "\d+ images" --only-matching | grep -P "\d+" --only-matching` | + | numframes=$(gifsicle "$1" -I | grep --perl-regexp --only-matching '\d+ images' | grep --perl-regexp --only-matching "\d+") |
# Deletion | # Deletion | ||
let i=0 | let i=0 | ||
- | while [[ $i -lt $numframes ]]; do | + | while test $i -lt $numframes |
+ | do | ||
rem=$(( $i % 2 )) | rem=$(( $i % 2 )) | ||
- | if [ $rem -eq 0 ] | + | if test $rem -eq 0 |
then | then | ||
- | gifsicle $2 --delete "#"$(($i/2)) -o $2 | + | gifsicle "$2" --delete "#"$(($i/2)) -o "$2" |
fi | fi | ||