[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] gerar string
From: |
Herbert Alexander Faleiros |
Subject: |
Re: [shell-script] gerar string |
Date: |
Tue, 24 Jan 2006 23:19:21 -0200 |
User-agent: |
KMail/1.9 |
On Tuesday 24 January 2006 22:27, Tiago Barcellos Peczenyj wrote:
> Aqui há um exemplo para gerar uma senha com 8 digitos
> http://www.piterpunk.hpg.ig.com.br/dicas.html#30
A dica do Punk é bem legal, mas para quem não tem o metamail instalado (por
causa do mimencode), algo do tipo resolve o problema:
#!/bin/sh
ALFA=abcdefghijklmnopqrstuvwxyz
# Quantas senhas
QUANTIDADE=8
# Comprimento das senhas
COMPRIMENTO=6
for j in `seq $QUANTIDADE`; do
for i in `seq $COMPRIMENTO`; do
SENHA=$SENHA${ALFA:`expr $RANDOM % 26`:1};
done
echo "fulano$j;$SENHA"
echo "fulano$j;$SENHA" >> saida.txt
SENHA=
done
Saída do script (no formato que sugeriu, ou seja, "usuário;senha"):
$ ./senhas
fulano1;pxfweu
fulano2;tbsaqz
fulano3;xnwmul
fulano4;jsiqhp
fulano5;nemclb
fulano6;aiqgpf
fulano7;emclbj
fulano8;iygxfv
Até,
Herbert.
- gerar string, Celso Viana, 2006/01/24
- Re: [shell-script] gerar string, Tiago Barcellos Peczenyj, 2006/01/24
- Re: [shell-script] gerar string,
Herbert Alexander Faleiros <=
- Re: [shell-script] gerar string, Celso Viana, 2006/01/25
- Re: [shell-script] gerar string, Tiago Barcellos Peczenyj, 2006/01/25
- Re: [shell-script] gerar string, Gentil de Bortoli Júnior, 2006/01/25
- Re: [shell-script] gerar string, Celso Viana, 2006/01/25
- Re: [shell-script] gerar string, Fabiano Caixeta Duarte, 2006/01/25
- Re: [shell-script] gerar string, Celso Viana, 2006/01/25
- Re: [shell-script] gerar string, Fabiano Caixeta Duarte, 2006/01/25
- Re: [shell-script] gerar string, Herbert Alexander Faleiros, 2006/01/25