[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ${var@P} expansion includes 0x01 and 0x02
From: |
Greg Wooledge |
Subject: |
Re: ${var@P} expansion includes 0x01 and 0x02 |
Date: |
Fri, 6 Nov 2015 08:19:42 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Nov 05, 2015 at 06:45:45PM -0600, Dennis Williamson wrote:
> red=$(tput setaf 1)
> none=$(tput sgr0)
> greet='\[$red\]Hello\[$none\]'
> printf '%s\n' "${greet@P}"
> echo -e "${greet@P}"
> read -e -p "${greet@P}"
>
> Naively stripping the delimiters in this case would leave $redHELLO$none
> where $redHello is unset or worse.
Well, obviously you wouldn't do it that way. It would be much simpler
to strip the \x01 and \x02 from the output string.