Je suis sous Ubuntu 20.04. Je veux imprimer ce de bash et j'ai essayé printf "\u1F5E0"
mais ça n'a pas marché. Est-ce que cela est censé fonctionner ou bien il me manque des paquets de polices ? Veuillez me conseiller sur ce que je dois faire.
Réponse
Trop de publicités?
gilles gaido
Points
113
Pouvez-vous essayer ceci (avec une majuscule) U ) ?
printf "\U1f5e0"
o echo -e "\U1f5e0"
Cela devrait fonctionner en fonction de votre locale bash ( LANG=en_US.UTF-8
o LANG=fr_FR.UTF-8
) qui peut être défini dans votre fichier de configuration .bashrc ou dans votre script.
Voici ce que le man bash
page dit :
Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape se
quences, if present, are decoded as follows:
\a alert (bell)
\b backspace
\e
\E an escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\' single quote
\" double quote
\? question mark
\nnn the eight-bit character whose value is the octal value nnn (one to three octal digits)
\xHH the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
\uHHHH the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH (one to four hex digits)
\UHHHHHHHH
the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits)
\cx a control-x character
The expanded result is single-quoted, as if the dollar sign had not been present.
A double-quoted string preceded by a dollar sign ($"string") will cause the string to be translated according to the current locale. If the current locale is C or POSIX, the dollar
sign is ignored. If the string is translated and replaced, the replacement is double-quoted.