According to tr(1) manual -C
means:
Complement the set of characters in string1, that is ``-C ab'' includes every character except for `a' and `b'.
..and -c
means:
Same as -C but complement the set of values in string1.
Now if I use -c
in the above command, it works as I expect:
$ echo $(dd if=/dev/urandom count=1 2>/dev/null | tr -dc 'A-Za-z0-9')
BAP0EctPYxpGgJmWYclqHj2eBWfZvVJs7nL6Y6YQiguGoZgziCceLe3TcyeV4uUi1R1yPW98s8LgiC8iNS1F60tEE2nXAHNi6L6IVS3CXBn94oPLGppxAgp
$
..but -C
doesn't:
$ echo $(dd if=/dev/urandom count=1 2>/dev/null | tr -dC 'A-Za-z0-9')
���hA����W���t�W��eu�C���W��o��A��xz�����M��p���x��2q����10O���������������p�R���t��I���c�8Z��Rq�9�L�Z��u����ot�n�T��n�nI��3i�yj�CuK��v�Ny�0�������i1�W�Lo�do�����TckL����i�rn��Wc��T���3����X��Z�M�e���I��J��I���A�5Y�����h���K���������ai������S����aZ�G���oab8��������4�g���G��g��0����I���H2�XGo���1�7���Ls�9H��7�b���Sf���E��Tv����mE�����3���l���S�88z��nl�p�f����w�E���Y�q�p���B�
$
How to understand this set of characters
vs set of values
?
-c
and-C
are literally synonyms and both of your examples behave as example 1 does. – msw May 06 '13 at 11:32