Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[PATCH] Fix randpass -f 2 to not produce empty passwords

The echo builtin interprets "-e" and "-n" which can lead randpass into
generating empty passwords under some conditions. This patch uses
the printf builtin instead to avoid the issue.

(From a private mail from Timo Juhani Lindfors).
  • Loading branch information...
commit ecd036647c345b235e9c77a0186f6d8cf1d8e424 1 parent 2f0cd92
@skx authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  randpass
3  randpass
@@ -56,4 +56,5 @@ done
# Output the password
-echo $(cat /dev/urandom | tr -cd "$cset" | head -c $len )
+printf "%s\n" $(cat /dev/urandom | tr -cd "$cset" | head -c $len )
Please sign in to comment.
Something went wrong with that request. Please try again.