#!/bin/bash # Comptage des lignes de code. # find $1 -print0 | xargs -0 touch # That terminates each filename with \000 (character 0) and instructs xargs to expect the filenames terminated by \000 # # -print0 # True; print the full file name on the standard output, followed # by a null character (instead of the newline character that # -print uses). This allows file names that contain newlines or # other types of white space to be correctly interpreted by pro‐ # grams that process the find output. This option corresponds to # the -0 option of xargs. echo -n "Lignes de code: " find . \ \( \ -name '*.c' -o \ -name '*.C' -o \ -name '*.h' -o \ -name '*.H' -o \ -name '*.cxgate' \ \) \ -print0 | xargs -0 cat | wc -l echo -n "Fichiers: " find . \ \( \ -name '*.c' -o \ -name '*.C' -o \ -name '*.h' -o \ -name '*.H' -o \ -name '*.cxgate' \ \) \ -print | wc -l