STRING-UNESCAPE(1)
β¨ STRING-UNESCAPE β¨
okay so bestie, real talk β this is string-unescape(1) from the fish-shell manuals, and it's the page that handles expand escape sequences. it's two commands in a trench coat: string escape and string unescape, and they're literally inverses of each other. iykyk π
π«Ά 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 flavor, they're all iconic in their own right:
--style=scriptβ this is the default, and it alters the string so it can be passed back toevaland produce the original argument again. by default, all special characters get escaped, and quotes are used to simplify the output when possible. if you pass-nor--no-quoted, that simplifying quoted format just... isn't used. no cap. Exit status:0if at least one string was escaped, or1otherwise. simple as that β¨--style=varβ makes sure the string can be used as a variable name by hex encoding any non-alphanumeric characters. heads up though: the string is first converted to UTF-8 before being encoded. that's the law π--style=urlβ makes the string safe to use as a URL by hex encoding any character which is not legal in a URL. and yes, obsessed, it also converts the string to UTF-8 before being encoded first πΈ--style=regexβ escapes an input string so it matches literally within a regex expression. you guessed it: the string is first converted to UTF-8 before being encoded π¦
now for the other half of the duo: string unescape performs the inverse of the string escape command. but bestie, listen β if the string to be unescaped is not properly formatted, it is ignored. no error, no drama, just ignored π
for example, doing string unescape --style=var (string escape --style=var $str) will return the original string. round trip slay π
β οΈ important: there is no support for unescaping --style=regex. sorry regex girlies, it's just not happening π
π EXAMPLES π
here's the receipts, fr fr:
>_ echo \x07 | string escape
\cg
>_ string escape --style=var 'a1 b2'\u6161
a1_20_b2_E6_85_A1_
the way that second one just hex-encoded its whole life... main character energy π
π Copyright
fish-shell developers β give them their flowers π
okay that's the whole page!! no gatekeeping here. version 4.9, dated Sep 08, 2026, straight from the fish-shell fam β go forth and escape responsibly, bestie π«Άπ
π¦ 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