Archived
1
0
Fork 0

test/h_touchdir.sh: helper shellscript

This commit is contained in:
Henrik Hautakoski 2010-09-26 20:43:37 +02:00
parent 5ec71fe7d2
commit 7106d9aa5e

27
test/h_touchdir.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
#
# Helper for touching a number of files in a directory.
if [ $# -lt 1 ]; then
echo "usage: $0 <dir> [ <nfiles> ]"
exit 1
fi
if [ ! -d $1 ]; then
echo "ERROR: '${1}' is not a directory"
exit 1
fi
NFILES=1024
if [ $# -gt 1 ]; then
if [ ! -z "${2##[0-9]*}" ]; then
echo "ERROR: '${2}' is not a positive integer"
exit 1
fi
NFILES=$2
fi
for i in `seq 0 ${NFILES}`; do
touch "${1}/file${i}"
done