#!/bin/bash # Filename: passcard.sh # Version: 120212 # Author: robz # Generates a random alpha-numeric text block for a password card. # Just double click and run, the text block file will appear in the same # directory as the script.
DATEMARK=$(date +%d-%m-%y" @ "%H:%M:%S) BLOCKLOC="$(dirname $0)/Passcard generated on $DATEMARK/Alphanumeric block.txt" mkdir "$(dirname "$BLOCKLOC")" # Create a new directory. for x in {1..8}; do # Loop to create 8 lines. tr -cd [:alnum:] < /dev/urandom |\ head -c 29 >> "$BLOCKLOC" # Write alpha-numeric line. echo >> "$BLOCKLOC" # Move to next line. done echo -e "Generated $DATEMARK" >> "$BLOCKLOC" # Date/time of generation.
No comments:
Post a Comment