|
CS469 - Linux and Unix Administration and Networking
| Displaying exercises/e5/solution/e.sh
#!/bin/bash
# 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
IFS=":";
a="abcdefghijklmnopqrstuvwxyz";
w="";
for((i=0;i<8;i++))
do
let c=RANDOM%26;
w="$w${a:$c:1}";
done
echo "$w";
|