#!/bin/bash # Random File Name #set -x EXT=$1 #Get help if -h is added as an option if [ "$EXT" == "-h" ] then echo "Usage is \``basename $0`\` or if you want the extention : \``basename $0` extention\`" echo "e.g. \``basename $0` txt\` will give the following:" exec $0 txt fi if [ "$EXT" != "" ] then EXT="."${EXT} fi #parameters SUB='houghi.eu/s' DIR=/srv/www/$SUB URL=http://$SUB MATRIX=(0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) #No need to change anything below here LEN=${#MATRIX[*]} #Make a random name DATE=`date +%s%N|cut -b 2-12|rev` DATE=`echo "obase=${LEN};$DATE" | bc` for CHAR in $DATE do CHAR=`echo $CHAR|bc` FILE=${FILE}${MATRIX[$CHAR]} done #Turn the name in to links and other things FILE=${FILE}${EXT} echo $FILE echo $DIR/$FILE echo $URL/$FILE