···11+#!/bin/bash
22+33+# Default value if no argument is provided
44+LENGTH=48
55+66+# If the user provides one numeric argument, use it instead
77+if [[ $# -eq 1 && $1 =~ ^[0-9]+$ ]]; then
88+ LENGTH=$1
99+elif [[ $# -gt 1 ]]; then
1010+ echo "Usage: $0 [length]"
1111+ exit 1
1212+fi
1313+1414+# Run the command
1515+openssl rand -hex "$LENGTH"
1616+
-16
dot_local/bin/randkey
···11-#!/bin/bash
22-33-# Default value if no argument is provided
44-LENGTH=48
55-66-# If the user provides one numeric argument, use it instead
77-if [[ $# -eq 1 && $1 =~ ^[0-9]+$ ]]; then
88- LENGTH=$1
99-elif [[ $# -gt 1 ]]; then
1010- echo "Usage: $0 [length]"
1111- exit 1
1212-fi
1313-1414-# Run the command
1515-openssl rand -hex "$LENGTH"
1616-