ワンライナー
ruby -e 'puts Array.new((ARGV[0] || 32).to_i){ rand(62) }.pack(%q!C*!).tr(%Q!\x00-\x3e!, %q!A-Za-z0-9!)'
実行結果
% ruby -e 'puts Array.new((ARGV[0] || 32).to_i){ rand(62) }.pack(%q!C*!).tr(%Q!\x00-\x3e!, %q!A-Za-z0-9!)'
DZjADuaVlU9kCKDwex1yZoyPi0TysMfT
.zshrcへ追加
alias pw="ruby -e 'puts Array.new((ARGV[0] || 32).to_i){ rand(62) }.pack(%q!C*!).tr(%Q!\x00-\x3e!, %q!A-Za-z0-9!)'"
zsh経由で使う
% pw 16
SKZUBmGLAULN33IC
% pw 32
5mit4kh5iyKDiZddd3DkLyFhPuCf0DnQ
% pw 64
2R956EM9Sd08lVXYTkTlwlBECudScOitmw9Q6yC0qV8eXTfi4FmmHNS1xsPCAzWY