#!/bin/bash if [ -e $1 ]; then NUMBERCHARS=42 else NUMBERCHARS=$1 fi cat /dev/urandom | tr -cd 'a-f0-9' | head -c $NUMBERCHARS ; echo