1. create a function to generate file with the filename start with 10 random characters
#!/bin/bash WORK_DIR=/tmp/00 #define the function create(){ i=1 while [ $i -le 5 ] do
if [ ! -d $WORK_DIR ]
then
mkdir -p $WORK_DIR cd $WORK_DIR && touch `</dev/urandom tr -dc "a-z" | head -c 10`_test.txt
else
cd $WORK_DIR && touch `</dev/urandom tr -dc "a-z" | head -c 10`_test.txt
fi
i=$(( $i+1 ))
done
}
# invoke the function
create