Re: Unexpected Quick Substitution in string literals

2023-12-14 Thread Chet Ramey
On 12/14/23 2:59 PM, Dale R. Worley wrote: Chet Ramey writes: While declaring a string literal across multiple lines, a line starting with the ^ character is resulting in some sort of quick substitution processing. This is a standard form of history expansion, described in the man page. I

Re: Unexpected Quick Substitution in string literals

2023-12-14 Thread Dale R. Worley
Chet Ramey writes: >> While declaring a string literal across multiple lines, a line starting >> with the ^ character is resulting in some sort of quick substitution >> processing. > > This is a standard form of history expansion, described in the man page. I just checked. Certainly, the use of

Re: [PATCH] preserve $_ value across prompt expansions

2023-12-14 Thread Chet Ramey
On 12/14/23 1:24 PM, Grisha Levit wrote: On Thu, Dec 14, 2023, 12:51 Chet Ramey > wrote: On 12/12/23 3:55 PM, Grisha Levit wrote: > Since expanding a prompt string that contains a funsub will modify the > value of $_, would it make sense to restore the

Re: [PATCH] preserve $_ value across prompt expansions

2023-12-14 Thread Grisha Levit
On Thu, Dec 14, 2023, 12:51 Chet Ramey wrote: > On 12/12/23 3:55 PM, Grisha Levit wrote: > > Since expanding a prompt string that contains a funsub will modify the > > value of $_, would it make sense to restore the value of $_ after the > > expansion is complete, as we do when executing

Re: [PATCH] preserve $_ value across prompt expansions

2023-12-14 Thread Chet Ramey
On 12/12/23 3:55 PM, Grisha Levit wrote: Since expanding a prompt string that contains a funsub will modify the value of $_, would it make sense to restore the value of $_ after the expansion is complete, as we do when executing PROMPT_COMMAND? If we're worried about this as a side effect, why

Re: bash should consult .config/bash/...

2023-12-14 Thread Chet Ramey
On 12/10/23 1:32 AM, Koichi Murase wrote: - interactive posix -> $ENV - interactive non-posix -> N/A (hardcoded to be ~/.bashrc) There isn't a variable, but you can specify it using the --rcfile command line option. - non-interactive posix -> N/A - non-interactive non-posix -> $BASH_ENV

Re: Unexpected Quick Substitution in string literals

2023-12-14 Thread Chet Ramey
On 12/13/23 12:20 AM, Sundeep Agarwal wrote: Bash Version: 5.0 Patch Level: 17 Release Status: release Description: While declaring a string literal across multiple lines, a line starting with the ^ character is resulting in some sort of quick substitution processing. This is a standard

Re: Add example of bind readline-command-line

2023-12-14 Thread Chet Ramey
On 12/12/23 9:06 AM, Dan Jacobson wrote: bash man page says -v Display readline variable names and values in such a way that they can be re-read. Perhaps add an example of rereading via the bind command: $ bind 'set bell-style visible' else the user

Re: Unexpected Quick Substitution in string literals

2023-12-14 Thread Greg Wooledge
On Thu, Dec 14, 2023 at 09:41:17AM +0530, Sundeep Agarwal wrote: > Thanks for the correction on my second example. I had assumed ^ wasn't > special inside double quotes since the documentation mentions only the ! > character for history expansion ( >

Re: funsub questions

2023-12-14 Thread Greg Wooledge
On Thu, Dec 14, 2023 at 04:44:07AM +, Kerin Millar wrote: > On Wed, 13 Dec 2023 23:16:11 -0500 > Zachary Santer wrote: > > > On Wed, Dec 13, 2023 at 11:06 PM Greg Wooledge wrote: > > > Is that on a system that lacks a process manager? Something like > > > "systemctl reload ssh" or "service

Re: funsub questions

2023-12-14 Thread Andreas Schwab
On Dez 13 2023, Greg Wooledge wrote: > If you'd like to read the contents of a file into a variable, the > "read" and "readarray" (aka "mapfile") builtins are usually better > choices anyway. $(< file) would only be useful if you want the entire > content in a single string variable, which is a