On Mon, Nov 9, 2015 at 5:09 PM, Dennis Williamson <
dennistwilliam...@gmail.com> wrote:

>
>
> On Thu, Nov 5, 2015 at 6:26 PM, Dennis Williamson <
> dennistwilliam...@gmail.com> wrote:
>
>> It might be handy to have some of the escapes that work in $'string'
>> quoting to also work in prompts especially now with the ${parameter@P}
>> transformation.
>>
>> Specifically the hex, unicode and control ones: \xHH, \uHHHH, \UHHHHHHHH
>> and \cx.
>>
>> I presume that the dollar-single-quote escapes should not be touched
>> since they are "specified by the ANSI C standard". Also, they needn't be
>> since we have the @P transformation.
>>
>> --
>> Visit serverfault.com to get your system administration questions
>> answered.
>>
>
>
> I obviously overlooked the collision between \u - username and \uHHHH -
> unicode. It could be dealt with by interpreting the escape as username if
> the following character is non-hex, but that would stand a good chance of
> breaking existing prompts. Since \U functionally is a complete superset of
> \u - unicode, perhaps the latter wouldn't need to be duplicated for
> prompting.
>
>
> --
> Visit serverfault.com to get your system administration questions
> answered.
>


Of course, the obvious way to do this is to assign a variable using
$'\uHHHH' or similar.

dbl_6_dom=$'\U1F061'
prompt='\u, something about dominoes $dbl_6_dom \@ '
echo "${prompt@P}"

But wait, you don't need the intermediate step! It already works!!!

prompt=$'\u, something about dominoes \U1F061  \@ '
echo "${prompt@P}"


-- 
Visit serverfault.com to get your system administration questions answered.

Reply via email to