Open MegaV0lt opened 1 year ago
@MegaV0lt since the printf format string uses double quotes instead of single-quotes, parameter expansion and command substitutions will be applied, as well as backslash escapes - twice. Hence the \\n
is reduced to \n
when you declare the function and printf ... prints a \n
.
Since someone may go ahead and stupidly copy-paste this in like
cat > my_source-able_file.sh <<EOF
date() {
# Usage: date "format"
# See: 'man strftime' for format.
printf "%($1)T\\n" "-1"
}
EOF
... they'll still get a working function even if they make that mistake.
I think there is an extra '\' in the printf command