Pierre Maitre wrote:
Bonsoir
J'ai un probl�me avec le petit script de F�lix. Ca m'est tomb� dessus en
bidouillant sur la ligne de commande pour essayer de comprendre ce que
faisait le printf:
[maitre@anesth1 tmp]$ i=97
[maitre@anesth1 tmp]$ printf "\\%3o\n" $i
\141
[maitre@anesth1 tmp]$ echo -e $(printf "\\%3o" $i)
a
Jusque l�, pas de probl�me, mais maintenant je substitue:
[maitre@anesth1 tmp]$ echo -e $(\141)
bash: 141: command not found
L� je comprends plus
man bash dit (entre autre) :
A non-quoted backslash (\) is the escape character. It
preserves the literal value of the next character that
follows
Donc �\1� signifie �1�, donc �\141� signifie �141� et $(\141)
signifie $(141). Ceci est cens� �tre remplac� par la sortie
de la commande �141�, mais elle n'existe pas !
Note: �echo -e $(printf "\\%3o" $i)� est plus �quivalent �
�echo -e \\141�. Certes le printf ne produit qu'un seul �\�
mais man bash dit encore :
When the old-style backquote form of substitution is used,
backslash retains its literal meaning except when followed
by $, `, or \. The first backquote not preceded by a
backslash terminates the command substitution. When using
the $(command) form, all characters between the parenthe�-
ses make up the command; none are treated specially.
Marc Mongenet
--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question. Ouais, pour se d�sabonner aussi.