STRING-ESCAPE(1)
π¦ string-escape β escape special characters β¨
okay so bestie, welcome to string-escape, brought to you by the fish-shell girlies π
this one's all about taking your messy little strings and making them presentable for whatever's about to eat them.
πΈ SYNOPSIS πΈ
string escape [-n | --no-quoted] [--style=] [STRING ...]
string unescape [--style=] [STRING ...]
π DESCRIPTION π
string escape escapes each STRING in one of several ways. pick your vibe, bestie π
--style=script(the default, main character energy π) β alters the string so it can be passed back toevalto produce the original argument again. by default all special characters get escaped, and quotes are used to simplify the output when possible. if-nor--no-quotedis given, that simplifying quoted format is not used. exit status:0if at least one string was escaped, or1otherwise. no cap.--style=varβ makes sure the string can be used as a variable name by hex encoding any non-alphanumeric characters. and the string gets converted to UTF-8 first before being encoded, fyi π§--style=urlβ makes sure the string can be used as a URL by hex encoding any character which is not legal in a URL. string's converted to UTF-8 first before encoding too, periodt.--style=regexβ escapes an input string for literal matching within a regex expression. yup, UTF-8 conversion first again, then encoded β¨
string unescape does the literal inverse of the string escape command π but heads up β if the string to be unescaped is not properly formatted, it just gets ignored. like, respectfully, it doesn't want the drama π
for example, doing string unescape --style=var (string escape --style=var $str) will return the original string. slay.
β οΈ there is no support for unescaping --style=regex. that one's a one-way street, bestie π
π₯ EXAMPLES π₯
>_ echo \x07 | string escape
\cg
>_ string escape --style=var 'a1 b2'\u6161
a1_20_b2_E6_85_A1_
look at that glow-up ππ
π Copyright π
fish-shell developers π«Ά
and that's the whole page, bestie!! this was string-escape from the fish-shell fam, version 4.9, dated Sep 08, 2026 π go forth and escape responsibly β¨π¦
π¦ where this page comes from
- arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms