December 2018
Beginner
452 pages
12h 17m
English
So, we've already created two password generators. Since three is the magic number, and this is a really good example to demonstrate chaining pipes, we'll create one more (the last one, promise):
reader@ubuntu:~/scripts/chapter_12$ vim piped-passwords.shreader@ubuntu:~/scripts/chapter_12$ cat piped-passwords.sh #!/bin/bash###################################### Author: Sebastiaan Tammer# Version: v1.0.0# Date: 2018-11-10# Description: Generate a password, using only pipes.# Usage: ./piped-passwords.sh#####################################password=$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c20)echo "Your random password is: ${password}"
First, we grab the first 10 lines from /dev/urandom (the default behavior ...