bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [feature request] parameter transformation to safely add strings to


From: Lawrence Velázquez
Subject: Re: [feature request] parameter transformation to safely add strings to PS1, &c.
Date: Sun, 22 Aug 2021 22:33:13 -0400

> On Aug 22, 2021, at 10:22 PM, Koichi Murase <myoga.murase@gmail.com> wrote:
> 
> 2021年8月23日(月) 6:13 Emanuele Torre <torreemanuele6@gmail.com>:
>> It would be nice to have a parameter transformation (e.g. "${par@p}")
>> that expands $par to a string that will not be expanded by PS1, PS2, &c.
> 
> It seems to me that you can just put '$par' (not "$par") in PS1.
> Then, the suggested "${par@p}" can be simply '$par', which isn't worth
> implementing as a new transform.  You can write
> 
>  PS1='blabla $tmp_var blabla'
> 
> Or
> 
>  PS1="blabla \$tmp_var blabla"

An example in the original post asserted that tmp_var "will not
exist when PS1 is expanded", so it must be inserted when PS1 is
defined.  This requirement seems pretty contrived to me (why can't
tmp_var be kept around, exactly?), but that's what was postulated.

-- 
vq


Begin forwarded message:

> From: Emanuele Torre <torreemanuele6@gmail.com>
> Subject: [feature request] parameter transformation to safely add strings to 
> PS1, &c.
> Date: August 22, 2021 at 5:11:53 PM EDT
> To: bug-bash@gnu.org
> 
> It would be nice to have a parameter transformation (e.g. "${par@p}")
> that expands $par to a string that will not be expanded by PS1, PS2, &c.
> 
> example:
> 
>  tmp_var=$(blabla) # this variable will not exist when PS1 is expanded
>  PS1="blabla ${tmp_var@p} blabla"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]