Re: manipuler des chaines de caracteres
Pascal Bourguignon a écrit :
> Oui, mais là, tu utilises dd. C'est de la triche, on demandait un
> script shell, pas un dd...
>
> #!/bin/bash
> chars=' !\"#$%&'\''()*+,-./0123456789:;<=>?'
> chars="$chars"'@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'
> chars="$chars"'\`abcdefghijklmnopqrstuvwxyz\{\|\}\ ~'
> echo -n 'Generated: '
> i=0 ; while [ $i -lt 8 ] ; do
> echo -n "${chars:$(( $RANDOM % ( 1 + ${#chars} ) )):1}"
> # I know about print, but it's an external program.
> i=$(( $i + 1 ))
> done
> echo ''
>
Parfait. Merci
|