Re: funsub questions

2023-12-13 Thread Kerin Millar
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 ssh reload" would be preferred from > > a system admin POV, on systems tha

Re: funsub questions

2023-12-13 Thread Zachary Santer
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 ssh reload" would be preferred from > a system admin POV, on systems that have process managers. I am not super knowledgeable in this kind

Re: Unexpected Quick Substitution in string literals

2023-12-13 Thread Sundeep Agarwal
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 ( https://www.gnu.org/software/bash/manual/bash.html#Double-Quotes). However, no character should be treated specially ins

Re: funsub questions

2023-12-13 Thread Greg Wooledge
On Wed, Dec 13, 2023 at 10:48:59PM -0500, Zachary Santer wrote: > On Wed, Dec 13, 2023 at 9:17 PM 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 o

Re: funsub questions

2023-12-13 Thread Zachary Santer
On Wed, Dec 13, 2023 at 9:17 PM 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 variab

Re: funsub questions

2023-12-13 Thread Greg Wooledge
On Thu, Dec 14, 2023 at 02:39:04AM +, Kerin Millar wrote: > On Wed, 13 Dec 2023 21:17:05 -0500 > Greg Wooledge wrote: > > > On Wed, Dec 13, 2023 at 08:50:48PM -0500, Zachary Santer wrote: > > > Would there be a purpose in implementing ${< *file*; } to be the > > > equivalent > > > of $(< *fi

Re: funsub questions

2023-12-13 Thread Kerin Millar
On Wed, 13 Dec 2023 21:17:05 -0500 Greg Wooledge wrote: > On Wed, Dec 13, 2023 at 08:50:48PM -0500, Zachary Santer wrote: > > Would there be a purpose in implementing ${< *file*; } to be the equivalent > > of $(< *file* )? Does $(< *file* ) itself actually fork a subshell? > > $(< file) does ind

Re: funsub questions

2023-12-13 Thread Kerin Millar
On Wed, 13 Dec 2023 20:50:48 -0500 Zachary Santer wrote: > Would there be a purpose in implementing ${< *file*; } to be the equivalent > of $(< *file* )? Does $(< *file* ) itself actually fork a subshell? No, $(< file) does not fork. > > Would using funsubs to capture the stdout of external co

Re: funsub questions

2023-12-13 Thread Greg Wooledge
On Wed, Dec 13, 2023 at 08:50:48PM -0500, Zachary Santer wrote: > Would there be a purpose in implementing ${< *file*; } to be the equivalent > of $(< *file* )? Does $(< *file* ) itself actually fork a subshell? $(< file) does indeed fork. The only difference between $(< file) and $(cat file) is

funsub questions

2023-12-13 Thread Zachary Santer
Would there be a purpose in implementing ${< *file*; } to be the equivalent of $(< *file* )? Does $(< *file* ) itself actually fork a subshell? Would using funsubs to capture the stdout of external commands be appreciably faster than using comsubs for the same? - Zack

Re: Unexpected Quick Substitution in string literals

2023-12-13 Thread Greg Wooledge
On Wed, Dec 13, 2023 at 10:50:16AM +0530, Sundeep Agarwal wrote: > $ echo "fig > ^mango" > bash: :s^mango": substitution failed I can confirm this happens in every version of bash, at least back to bash-2.05b which is as far as I can go, but only when history expansion is enabled (set -H or set -o

Unexpected Quick Substitution in string literals

2023-12-13 Thread Sundeep Agarwal
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-Smvct5/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname out