mauvehed's dotfiles for personal and work environments
at main 16 lines 295 B view raw
1#!/bin/bash 2 3# Default value if no argument is provided 4LENGTH=48 5 6# If the user provides one numeric argument, use it instead 7if [[ $# -eq 1 && $1 =~ ^[0-9]+$ ]]; then 8 LENGTH=$1 9elif [[ $# -gt 1 ]]; then 10 echo "Usage: $0 [length]" 11 exit 1 12fi 13 14# Run the command 15openssl rand -hex "$LENGTH" 16