Bash-password-genorator: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
(Created page with "==Bash version== <pre> #!/bin/bash if -z $1 ; then CHAR=10 else CHAR=$1 fi strings /dev/urandom | grep -o 'alnum:' | head -n ${CHAR} | tr -d '\n'; echo '!' </pre...")
(No difference)

Revision as of 16:42, 15 October 2021

Bash version

#!/bin/bash
if [[ -z $1 ]]; then
  CHAR=10
else
  CHAR=$1
fi
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n ${CHAR} | tr -d '\n'; echo '!'

Shell version

#!/bin/sh
if [ -z $1 ]; then
  CHAR=10
else
  CHAR=$1
fi
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n ${CHAR} | tr -d '\n'; echo '!'