Skip to Content
Learn Linux Shell Scripting - Fundamentals of Bash 4.4
book

Learn Linux Shell Scripting - Fundamentals of Bash 4.4

by Sebastiaan Tammer
December 2018
Beginner
452 pages
12h 17m
English
Packt Publishing
Content preview from Learn Linux Shell Scripting - Fundamentals of Bash 4.4

Yet another password generator

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bash Scripting Fundamentals

Bash Scripting Fundamentals

Sander van Vugt

Publisher Resources

ISBN: 9781788995597Supplemental Content