add 1st line function

This commit is contained in:
2024-12-11 09:06:29 +01:00
parent 971a2c64f3
commit 2b72129621

View File

@@ -18,6 +18,11 @@ function getMachineNumber {
fi fi
} }
# get first line of file
function fisrstLine {
if [ ! -f $1 ] ; then echo -ne "0;" ; return 0 ; fi
head -n 1 $1
}
# file age # file age
# return 0 if given file mtime is older than given age (in day) # return 0 if given file mtime is older than given age (in day)
# arg1: file # arg1: file
@@ -65,10 +70,11 @@ function fileBiggerThan {
if [ $filesize -lt $2 ] ; then echo -ne "0;" ; else echo -ne "1;" ; fi if [ $filesize -lt $2 ] ; then echo -ne "0;" ; else echo -ne "1;" ; fi
} }
#Ok if file exists #Ok if file exists
# arg1: file to check # arg1: file to check
function fileMustExists { function fileMustExists {
if [ -f ${1} ] ; then echo -ne "1;" if [ -f "${1}" ] ; then echo -ne "1;"
else echo -ne "0;" else echo -ne "0;"
fi fi
} }