From 9538b1f0d6a9f0e5db29c05c989e062bbfb72d94 Mon Sep 17 00:00:00 2001 From: ThomasC Date: Fri, 19 Mar 2021 12:01:00 +0100 Subject: [PATCH] rajout numline --- functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions.sh b/functions.sh index d64bb63..0aa16a8 100644 --- a/functions.sh +++ b/functions.sh @@ -21,6 +21,13 @@ function fileMTime { stat --printf "%y;" $1 } +# file numline +# arg1: file +function fileNumLines { + if [ ! -f $1 ] ; then echo -ne "0;" ; return 0 ; fi + wc -l $1 | awk '{print $1}' +} + #ok if given program returns given code # arg1: program to run