Re: Squiggly heredoc - new feature request

2021-09-02 Thread Přemysl Šťastný
Hello. Thank you. If you don't want to implement it yourself, I am at your disposal. :) Just let me now. Best regards Přemysl On 9/1/21 4:11 PM, Chet Ramey wrote: On 8/31/21 3:25 PM, Lawrence Velázquez wrote: On Tue, Aug 31, 2021, at 4:02 AM, Lawrence Velázquez wrote: ksh does not blindly

Re: Squiggly heredoc - new feature request

2021-09-01 Thread Chet Ramey
On 8/31/21 3:25 PM, Lawrence Velázquez wrote: > On Tue, Aug 31, 2021, at 4:02 AM, Lawrence Velázquez wrote: >> ksh does not blindly remove all leading whitespace > > For the curious, this is how ksh(1) describes it: > > If '#' is appended to '<<', then leading spaces and tabs > will b

Re: Squiggly heredoc - new feature request

2021-08-31 Thread Lawrence Velázquez
On Tue, Aug 31, 2021, at 4:02 AM, Lawrence Velázquez wrote: > ksh does not blindly remove all leading whitespace For the curious, this is how ksh(1) describes it: If '#' is appended to '<<', then leading spaces and tabs will be stripped off the first line of the document and up

Re: Squiggly heredoc - new feature request

2021-08-31 Thread Oğuz
31 Ağustos 2021 Salı tarihinde Jesse Hathaway yazdı: > On Tue, Aug 31, 2021 at 2:24 AM Přemysl Šťastný wrote: > > > > Thanks for advice. How do you use it in more detail please? > > You can feed shfmt an individual file to format, it defaults to > using tabs for indentation: > > $ shfmt ~/test

Re: Squiggly heredoc - new feature request

2021-08-31 Thread Jesse Hathaway
On Tue, Aug 31, 2021 at 2:24 AM Přemysl Šťastný wrote: > > Thanks for advice. How do you use it in more detail please? You can feed shfmt an individual file to format, it defaults to using tabs for indentation: $ shfmt ~/test.sh #!/bin/bash cat <<-EOF hello! EOF Or you can instru

Re: Squiggly heredoc - new feature request

2021-08-31 Thread felix
Hi, > ... ignoring both leading spaces and leading tabs. eg. Something like (there must be nothing but tabulation before closing ``EOF'')? func(){   sed 's/^ \{2\}//' <<- EOF     blabla   EOF } Depending on how and why, there is a lot of *variants*: - leading spaces and/or/not

Re: Squiggly heredoc - new feature request

2021-08-31 Thread Lawrence Velázquez
> On Aug 31, 2021, at 3:16 AM, Přemysl Šťastný wrote: > > I didn't realize yesterday, that ksh93 is not a nick name, but ksh version > 93. :D Sort of. > So it would be okey with you, if I try to implement it using <<#? The bash maintainer (who is not me) hasn’t yet indicated whether this is

Re: Squiggly heredoc - new feature request

2021-08-31 Thread Přemysl Šťastný
Thanks for advice. How do you use it in more detail please? On 8/30/21 11:48 PM, Jesse Hathaway wrote: Will ksh93 version ever get to upstream? This ugly 'bug' is here for decades and really irritates me and many people, who ever used shell for larger scripting and don't like to use tabs. I use

Re: Squiggly heredoc - new feature request

2021-08-31 Thread Přemysl Šťastný
I didn't realize yesterday, that ksh93 is not a nick name, but ksh version 93. :D So it would be okey with you, if I try to implement it using <<#? Is there any git repo of bash? Thanks. P. On 8/30/21 11:43 PM, Lawrence Velázquez wrote: On Mon, Aug 30, 2021, at 5:22 PM, Přemysl Šťastný wrote

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Jesse Hathaway
> Will ksh93 version ever get to upstream? This ugly 'bug' is here for > decades and really irritates me and many people, who ever used shell for > larger scripting and don't like to use tabs. I used to always prefer spaces, until I switched to auto formatting all my Bash scripts with shfmt[1]. It

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Chris Elvidge
On 30/08/2021 09:28 pm, Greg Wooledge wrote: On Mon, Aug 30, 2021 at 10:06:37PM +0200, Přemysl Šťastný wrote: I think, it would be nice, if you implemented Squiggly heredoc, which solves this problem by ignoring both leading spaces and leading tabs. eg. func()( cat <<~ EOF blabla EOF

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Lawrence Velázquez
On Mon, Aug 30, 2021, at 5:22 PM, Přemysl Šťastný wrote: > Will ksh93 version ever get to upstream? I don't know what you mean by that. ksh is not "downstream" of bash; it is a separate project. Whether bash incorporates this feature or one like it is up to Chet, who hasn't yet chimed in. > Thi

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Přemysl Šťastný
Hi. Thank for your answer. Will ksh93 version ever get to upstream? This ugly 'bug' is here for decades and really irritates me and many people, who ever used shell for larger scripting and don't like to use tabs. Best regards P. On 8/30/21 11:14 PM, Lawrence Velázquez wrote: On Mon, Aug 3

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Lawrence Velázquez
On Mon, Aug 30, 2021, at 4:06 PM, Přemysl Šťastný wrote: > I think, it would be nice, if you implemented Squiggly heredoc, which > solves this problem by ignoring both leading spaces and leading tabs. eg. > > func()( >   cat <<~ EOF >     blabla >   EOF > ) '<<~' is already syntactically vali

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Greg Wooledge
On Mon, Aug 30, 2021 at 04:28:40PM -0400, Greg Wooledge wrote: > On Mon, Aug 30, 2021 at 10:06:37PM +0200, Přemysl Šťastný wrote: > > I think, it would be nice, if you implemented Squiggly heredoc, which solves > > this problem by ignoring both leading spaces and leading tabs. eg. > > > > func()(

Re: Squiggly heredoc - new feature request

2021-08-30 Thread Greg Wooledge
On Mon, Aug 30, 2021 at 10:06:37PM +0200, Přemysl Šťastný wrote: > I think, it would be nice, if you implemented Squiggly heredoc, which solves > this problem by ignoring both leading spaces and leading tabs. eg. > > func()( >   cat <<~ EOF >     blabla >   EOF > ) This would break backward compa

Squiggly heredoc - new feature request

2021-08-30 Thread Přemysl Šťastný
Hello. I have a problem with indentation in bash scripts with here documents. Normally, I use spaces for indentation, eg. func()(   blabla ) But if need to use here doc document in a function, I am forced to do eather func()(   cat <<- EOF         blabla         EOF ) or func()(   cat << E

Re: New Feature Request

2021-01-04 Thread Greg Wooledge
On Mon, Jan 04, 2021 at 10:44:40AM -0500, Saint Michael wrote: > can you point me to your FAQ? https://mywiki.wooledge.org/BashFAQ/045

Re: New Feature Request

2021-01-04 Thread Saint Michael
can you point me to your FAQ? On Mon, Jan 4, 2021 at 8:39 AM Greg Wooledge wrote: > On Mon, Jan 04, 2021 at 08:26:59AM -0500, Saint Michael wrote: > > In this case, how do I quickly increase the number stored in "foo"? > > the file has 1 as content, and I have a new value to add to it > quic

Re: New Feature Request

2021-01-04 Thread Léa Gris
Le 04/01/2021 à 14:14, Greg Wooledge écrivait : It should be noted that $( var=$(ending the last line because it exactly a sub-shell shot syntax for var=$(cat file). Sub-shell $(commands list) output is always trimmed. -- Léa Gris

Re: New Feature Request

2021-01-04 Thread Greg Wooledge
On Mon, Jan 04, 2021 at 08:26:59AM -0500, Saint Michael wrote: > In this case, how do I quickly increase the number stored in "foo"? > the file has 1 as content, and I have a new value to add to it quickly. > Is there an atomic way to read,add, write a value to "foo"? Nope! It's almost like b

Re: New Feature Request

2021-01-04 Thread Saint Michael
In this case, how do I quickly increase the number stored in "foo"? the file has 1 as content, and I have a new value to add to it quickly. Is there an atomic way to read,add, write a value to "foo"? On Mon, Jan 4, 2021 at 8:15 AM Greg Wooledge wrote: > On Fri, Jan 01, 2021 at 10:02:26PM +0

Re: New Feature Request

2021-01-04 Thread Greg Wooledge
On Fri, Jan 01, 2021 at 10:02:26PM +0100, Ángel wrote: > Yes. In fact, you can already do that using an interface exactly > identical to file operations: > > # Store a string in shared memory with key 'foo' > echo "Hello world" > foo > > # Read value of key foo > var="$( > > You only need to us

Re: New Feature Request

2021-01-01 Thread Ángel
On 2020-12-27 at 13:30 -0500, Saint Michael wrote: > Yes, superglobal is great. > Example, from the manual: > " Shared Memory > Shared memory allows one or more processes to communicate via memory > that appears in all of their virtual address spaces. The pages of the > virtual memory is referenced

Re: New Feature Request

2020-12-28 Thread felix
I agree: python seem to be more apropriated language for complex operation. Anyway, bash already offer a lot of features (like `coproc` and `read -t 0`) usefull for IPC. I wrote a little ``multiping`` bash script, as multithread demo, running many parallels ping, reading all outputs and merging t

Re: New Feature Request

2020-12-27 Thread Chet Ramey
On 12/27/20 1:30 PM, Saint Michael wrote: We could allow only strings or more complex objects, but using bash-language only, an internal mechanism, and also we need to define a semaphore. Is it doable? Of course it's doable; all that takes is requirements, definition, and implementation. The

Re: New Feature Request

2020-12-27 Thread Léa Gris
On 27/12/2020 at 19:30, Saint Michael wrote: Yes, superglobal is great. Example, from the manual: " Shared Memory Shared memory allows one or more processes to communicate via memory that appears in all of their virtual address spaces. The pages of the virtual memory is referenced by page table e

Re: New Feature Request

2020-12-27 Thread Saint Michael
Yes, superglobal is great. Example, from the manual: " Shared Memory Shared memory allows one or more processes to communicate via memory that appears in all of their virtual address spaces. The pages of the virtual memory is referenced by page table entries in each of the sharing processes' page t

Re: New Feature Request

2020-12-27 Thread Eli Schwartz
On 12/27/20 12:38 PM, Saint Michael wrote: Bash is very powerful for its ability to use all kinds of commands and pipe information through them. But there is a single thing that is impossible to achieve except using files on the hard drive or on /tmp. We need a new declare -g (global) where a var

New Feature Request

2020-12-27 Thread Saint Michael
Bash is very powerful for its ability to use all kinds of commands and pipe information through them. But there is a single thing that is impossible to achieve except using files on the hard drive or on /tmp. We need a new declare -g (global) where a variable would have its contents changed by subs