logoISU  

CS469/569 - Linux and Unix Administration and Networking

Spring 2022

Displaying ./code/02-10/h5/e.sh~

#!/bin/bash

# (2 points)
# Make a random password generator.  It should output a password composed of
# eight randomly picked lowercase letters (only lowercase letters, no other
# characters are allowed.)  Do not use /dev/random or /dev/urandom.
# Hint: Use RANDOM and the variable substring method to extract specific
# characters from a string.
# Example output:
# ./e.sh
# ipizlvrg

alphabet="abcdefghijklmnopqrstuv";

let x=$(( RANDOM % 26));
echo $x

# get out the $x-th letter of alphabet
echo ${alphabet:$x:1};