added isdirempty and embrio of patchfile
This commit is contained in:
@@ -108,4 +108,30 @@ installfile()
|
|||||||
}
|
}
|
||||||
export -f installfile
|
export -f installfile
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# determine if a directory is empty
|
||||||
|
isdirempty()
|
||||||
|
{
|
||||||
|
dir=$1
|
||||||
|
|
||||||
|
if [[ ! -d $dir ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
nbfiles=$(ls -a1 $dir | egrep -v '^.$|^..$' | wc -l)
|
||||||
|
if [[ $nbfiles -eq 0 ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# patch a file replacing all @var@ by the corresponding value in environment
|
||||||
|
patchfile()
|
||||||
|
{
|
||||||
|
: # todo
|
||||||
|
}
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user