[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: New feature
From: |
Greg Wooledge |
Subject: |
Re: Fwd: New feature |
Date: |
Sat, 12 Oct 2024 10:23:20 -0400 |
On Sat, Oct 12, 2024 at 09:50:03 -0400, Saint Michael wrote:
> The command printf needs a new flag, -e, that would mimic that way the
> same flag works with echo.
> After using printf, right now I need to lunch a second command if I
> need to expand the \n into real new lines.
>
> PROCEDURE_INFO=$(echo -e "${PROCEDURE_INFO}")
> this step would be redundant if printf had the flag.
Use the %b format specifier to expand backslashes in an argument.
hobbit:~$ var='a\tb\040c\x20d'
hobbit:~$ printf '%b\n' "$var"
a b c d
If you want the result in a variable, then:
printf -v newvar %b "$oldvar"