ajout base.tools.awk
This commit is contained in:
parent
3f47c40a0e
commit
e723f9bd3e
|
@ -2,3 +2,4 @@
|
|||
@include "base.core.awk"
|
||||
@include "base.array.awk"
|
||||
@include "base.date.awk"
|
||||
@include "base.tools.awk"
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
BEGIN {
|
||||
srand()
|
||||
}
|
||||
|
||||
function get_random_password( password, max, LETTERS) {
|
||||
LETTERS = "AZERTYUIOPQSDFGHJKLMWXCVBNazertyuiopqsdfghjklmwxcvbn0123456789"
|
||||
max = length(LETTERS)
|
||||
password = ""
|
||||
for (i = 0; i < 16; i++) {
|
||||
password = password substr(LETTERS, int(rand() * max), 1)
|
||||
}
|
||||
return password
|
||||
}
|
||||
|
||||
function should_generate_password() {
|
||||
return $0 ~ /XXXRANDOMXXX/
|
||||
}
|
||||
function generate_password() {
|
||||
sub(/XXXRANDOMXXX/, get_random_password())
|
||||
}
|
|
@ -88,3 +88,14 @@ function testsame() { diff -q "$@" >&/dev/null; }
|
|||
|
||||
function: testdiff "tester si deux fichiers sont différents en mode silencieux"
|
||||
function testdiff() { ! diff -q "$@" >&/dev/null; }
|
||||
|
||||
function: should_update "faut-il mettre à jour le \$1 qui est construit à partir de \$2..@"
|
||||
function should_update() {
|
||||
local dest="$1"; shift
|
||||
local source
|
||||
for source in "$@"; do
|
||||
[ -f "$source" ] || continue
|
||||
[ "$source" -nt "$dest" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue