issue89:command_conquer
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue89:command_conquer [2015/02/08 11:44] – [4] auntiee | issue89:command_conquer [2015/02/08 11:55] (Version actuelle) – [8] auntiee | ||
---|---|---|---|
Ligne 115: | Ligne 115: | ||
Lines 29-30 uses the trap command to empty the temporary folder when the script exits (including when the script is interrupted by the user or system – i.e. when you hit ctrl+c).** | Lines 29-30 uses the trap command to empty the temporary folder when the script exits (including when the script is interrupted by the user or system – i.e. when you hit ctrl+c).** | ||
- | Les lignes 9 à 25 contiennent une instruction if qui vérifie s'il y a des arguments, sinon, elle affiche | + | Les lignes 9 à 25 contiennent une instruction if qui vérifie s'il y a des arguments, sinon, elle affiche les informations d' |
Les lignes 27-28 créent un emplacement temporaire pour stocker les fichiers PDF pendant qu'ils sont en cours de traitement par le script (car on convertit le fichier PDF avec pdftotext pour utiliser grep sur les textes). C'est une pratique acceptée pour garder propres les résultats du script (c' | Les lignes 27-28 créent un emplacement temporaire pour stocker les fichiers PDF pendant qu'ils sont en cours de traitement par le script (car on convertit le fichier PDF avec pdftotext pour utiliser grep sur les textes). C'est une pratique acceptée pour garder propres les résultats du script (c' | ||
Ligne 127: | Ligne 127: | ||
Lines 46 – 54 is a for loop that checks the passed arguments for any beginning with a hyphen – as it is assumed it indicates an argument. If I were the one authoring this script, I would have opted for an array of acceptable options, and searched for them instead. If your filename starts with a hyphen, I would imagine the script would fail. However, it is pretty uncommon for a file to be named in such a way.** | Lines 46 – 54 is a for loop that checks the passed arguments for any beginning with a hyphen – as it is assumed it indicates an argument. If I were the one authoring this script, I would have opted for an array of acceptable options, and searched for them instead. If your filename starts with a hyphen, I would imagine the script would fail. However, it is pretty uncommon for a file to be named in such a way.** | ||
- | Les lignes 31 à 44 sont une boucle while qui demande à l' | + | Les lignes 31 à 44 sont une boucle while qui demande à l' |
Les lignes 46 à 54 sont une boucle for qui vérifie si les arguments passés commencent avec un tiret, car ils sont supposés indiquer un argument. Si j' | Les lignes 46 à 54 sont une boucle for qui vérifie si les arguments passés commencent avec un tiret, car ils sont supposés indiquer un argument. Si j' | ||
Ligne 137: | Ligne 137: | ||
Lines 96-101 check if the number of matched PDF files exists. If not, there were no matches, and the program exits.** | Lines 96-101 check if the number of matched PDF files exists. If not, there were no matches, and the program exits.** | ||
- | Les lignes 56 à 93 sont une boucle qui sert à inverser la vérification des lignes 46 à 54 (des arguments qui ne commencent pas par un tiret), et suppose que c'est un nom de fichier. Il commence alors une nouvelle ligne, affiche « pages correspondantes dans <nom de fichier> : <liste des pages> ». Au final, vous devriez avoir une liste de tous les fichiers PDF recherchés, | + | Les lignes 56 à 93 sont une boucle |
Les lignes 96 à 101 vérifient si le nombre de fichiers PDF correspondant à la recherche existe. Sinon, il n'y avait aucun résultat, et le programme se termine. | Les lignes 96 à 101 vérifient si le nombre de fichiers PDF correspondant à la recherche existe. Sinon, il n'y avait aucun résultat, et le programme se termine. | ||
Ligne 149: | Ligne 149: | ||
I've skimmed over certain specifics of the script for two reasons – one being brevity, and the other being that figuring out exactly how a script works simply by reading it and running it is a good skill to have, especially if you plan on writing your own scripts or programs. If anyone has particular questions about a certain segment of the script, you're welcome to send me a quick email. If you have any other questions, suggestions, | I've skimmed over certain specifics of the script for two reasons – one being brevity, and the other being that figuring out exactly how a script works simply by reading it and running it is a good skill to have, especially if you plan on writing your own scripts or programs. If anyone has particular questions about a certain segment of the script, you're welcome to send me a quick email. If you have any other questions, suggestions, | ||
- | Les lignes 102 à 112 couvrent le cas d'un fichier correspondant (et affichent « 1 fichier PDF correspondant », puis déplace le fichier temporaire dans le PDF final contenant les résultats, ce qui évite | + | Les lignes 102 à 112 couvrent le cas d'un fichier correspondant (et affichent « 1 fichier PDF correspondant », puis déplace le fichier temporaire dans le PDF final contenant les résultats, ce qui évite |
La ligne 113 - Cette ligne affiche simplement le nom du fichier résultant, pour que l' | La ligne 113 - Cette ligne affiche simplement le nom du fichier résultant, pour que l' | ||
- | J'ai passé | + | Je ne me suis pas étendu sur certaines spécificités du script pour deux raisons : l'une étant la concision et l' |
issue89/command_conquer.1423392261.txt.gz · Dernière modification : 2015/02/08 11:44 de auntiee