## You can use 'mktemp' ## Storing filename in a variable ## The X is replaced by random string tmpfile=$(mktemp /tmp/abc-script.XXXXXX)