$ string replace -r '(\w+)\s+(\w+)' '$2 $1 $$' 'left right' right left $ $ string replace -r '(\w+)\s+(\w+)' '\$2 \$1 $$' 'left right' right left $
string replacehas a superfluous round of unescaping in the replacement part so you'll have to double up the slashes one more time. There's no great way of fixing it so we've introduced a feature flag until we figure out how to detect it and warn about it.
$into "expand this" and
$. If it does too much unescaping that means you need more escaping. I do not believe this subtlety helps any in the explanation, so we've left it as "escaping".
If you also want the output, you can still use the
if set x (tmux ls | grep foo)
set doesn't set the status itself and simply passes on whatever the command substitution returned.
cmd 2>&1 >filedoesn’t redirect stderr to
cmd >file 2>&1does