Re: Handling files with CRLF line ending

2022-12-06 Thread Yair Lenga
hard core developers, just devops) are tasked with transfering existing solutions to WSL. I am not aware of hard data, but I believe those are underrepresented in this forum. I admit no hard data to support any of those. On Mon, Dec 5, 2022, 15:36 Chet Ramey wrote: > On 12/3/22 8:53 AM, Yair Le

Re: Handling files with CRLF line ending

2022-12-03 Thread Yair Lenga
dules are working in Linux. They are research people, with no access to window dev boxes. I would also mention: the research people have little interest in cross-platform portability issues. Yair On Sat, Dec 3, 2022 at 8:44 AM Greg Wooledge wrote: > On Sat, Dec 03, 2022 at 05:40:02AM -0500, Ya

Handling files with CRLF line ending

2022-12-03 Thread Yair Lenga
Hi, I was recently asked to deploy a bash/python based solution to windows (WSL2). The solution was developed on Linux. Bash is being used as a glue to connect the python based data processing (pipes, files, ...). Everything works as expected with a small BUT: files created by python can not be r

Re: Supporting structured data (was: Re: bug-bash Digest, Vol 238, Issue 2)

2022-09-07 Thread Yair Lenga
Another comment: While it’s important to use “natural” access, I believe it is ok to have a command to set values inside the h-value. It does not have to be supported as part of …=… , which has lot of history, rule, interaction with env var, etc. I think something like: hset var.foo.bar=value

Re: Supporting structured data (was: Re: bug-bash Digest, Vol 238, Issue 2)

2022-09-07 Thread Yair Lenga
(Yes that precludes $(( x $op y )) unless you're in compat > mode.) > > On Mon, 5 Sept 2022 at 19:55, Yair Lenga wrote: > >> Personally, I think adopting Javascript/Python like approach (${a.b.c} ) >> is preferred over using Perl approach ( ${a{b}{c}} ), or sticking w

Re: bug-bash Digest, Vol 238, Issue 2

2022-09-05 Thread Yair Lenga
ds compatibility mode would attempt to parse expressions but also > keep the literal text, so that when it later turns out that the variable is > an assoc array, it can use that rather than the expression tree. This would > of course suppress reporting expression syntax errors using ba

Re: bug-bash Digest, Vol 238, Issue 2

2022-09-04 Thread Yair Lenga
Putting aside the effort to implement, it might be important to think on how the h-data structure will be used by users. For me, the common use case will be to implement a simple, small "record" like structure to make it easier to write readable code. Bash will never be able to compete with Python/

Re: Light weight support for JSON

2022-08-28 Thread Yair Lenga
d expect such an > external tool to have and many many more. interfacing from curl to jq to > bash is something i do on a near daily basis. > > https://stedolan.github.io/jq/ > > On Sun, Aug 28, 2022, 09:25 Yair Lenga wrote: > >> Hi, >> >> Over the last few year

Re: Light weight support for JSON

2022-08-28 Thread Yair Lenga
quez wrote: > On Sun, Aug 28, 2022, at 9:24 AM, Yair Lenga wrote: > > Wanted to get feedback about the following "extensions" to bash that will > > make it easier to work with simple JSON object. To emphasize, the goal is > > NOT to "compete" with Python/

Re: bug-bash Digest, Vol 237, Issue 30

2022-08-28 Thread Yair Lenga
ease edit your Subject line so it is more specific > than "Re: Contents of bug-bash digest..." > > > Today's Topics: > >1. Bash Coding style - Adopting C99 declarations (Yair Lenga) >2. Re: Light weight support for JSON (Yair Lenga) >3. Re: Bash Coding style - Adop

Re: Light weight support for JSON

2022-08-28 Thread Yair Lenga
w7 Ratchev wrote: > > > On Sun, Aug 28, 2022, 15:46 Yair Lenga wrote: > >> Sorry for not being clear. I'm looking for feedback. The solution that I >> have is using python to read the JSON, and generate the commands to build >> the associative array. Will have to

Bash Coding style - Adopting C99 declarations

2022-08-28 Thread Yair Lenga
Hi, I've noticed Bash code uses "old-style" C89 declarations: * Parameters are separated from the prototype * Variables declared only at the beginning of the function * No mixed declaration/statements * No block local variables intmax_t evalexp (expr, flags, validp) char *expr; int flag

Re: Light weight support for JSON

2022-08-28 Thread Yair Lenga
2022 at 9:42 AM Alex fxmbsw7 Ratchev wrote: > > > On Sun, Aug 28, 2022, 15:25 Yair Lenga wrote: > >> Hi, >> >> Over the last few years, JSON data becomes a integral part of processing. >> In many cases, I find myself having to automate tasks that requi

Light weight support for JSON

2022-08-28 Thread Yair Lenga
Hi, Over the last few years, JSON data becomes a integral part of processing. In many cases, I find myself having to automate tasks that require inspection of JSON response, and in few cases, construction of JSON. So far, I've taken one of two approaches: * For simple parsing, using 'jq' to extrac

Re: Revisiting Error handling (errexit)

2022-07-12 Thread Yair Lenga
tch it (IHMO). Yair On Tue, Jul 12, 2022 at 6:08 PM Martin D Kealey wrote: > > > On Sun, 10 Jul 2022 at 05:39, Yair Lenga wrote: > >> Re: command prefaced by ! which is important: >> * The '!' operator 'normal' behavior is to reverse the exit status of a >> command ('if ! check-something ; then ...'). >> > >

Re: Revisiting Error handling (errexit)

2022-07-12 Thread Yair Lenga
air On Tue, Jul 12, 2022 at 6:08 PM Martin D Kealey wrote: > > > On Sun, 10 Jul 2022 at 05:39, Yair Lenga wrote: > >> Re: command prefaced by ! which is important: >> * The '!' operator 'normal' behavior is to reverse the exit status of a >> command

Re: Revisiting Error handling (errexit)

2022-07-09 Thread Yair Lenga
Hi Martin, Long answer - my own view: The old 'errexit' logic was spec'ed many years ago. As far as I can tell, it existed in bash 2.0, from 1996. I think requirements/expectations are different now. The 'exit on error' error handling was good for 1996 - does not meet today's requirement - using b

Re: Revisiting Error handling (errexit)

2022-07-08 Thread Yair Lenga
amp;& # Use the files for something - e.g., count the lines. important-job /production/path/file1 /production/path/file2 || return $? ls -l /production/path | mail -s "all-good" not...@company.com } On Fri, Jul 8, 2022 at 1:22 PM Oğuz wrote: > 8 Temmuz

Re: Revisiting Error handling (errexit)

2022-07-08 Thread Yair Lenga
ntinue to the 'else' section to send the alert. Thanks for taking the time to review. Patch on bash-devel attached. For those interested: 50 lines of code, most of them are comments. 8 hours of development, including automated test script. Looking for advice on how to "official

Re: Revisiting Error handling (errexit)

2022-07-06 Thread Yair Lenga
Koichi - Thanks for highlighting this 'local -'. This feature effectively eliminates the need to support scoped 'errfail'. If it's needed in a limited context, the 'local -' can be used. Yair On Wed, Jul 6, 2022 at 1:21 PM Koichi Murase wrote: > 2022年7

Re: Revisiting Error handling (errexit)

2022-07-06 Thread Yair Lenga
Hi. Thanks for proposal. For my use case, where I have large existing code base, where I want to improve error checking, and avoid unhandled errors, per function setting will not work. This will also deviate from the try ... Catch pattern used in many other scripting solution, making it hard for d

Re: bug-bash Digest, Vol 236, Issue 8

2022-07-05 Thread Yair Lenga
t thread. Until then, Bash is my tool. As stated before, I will extend the errfail to the top level, as not everyone uses bash in the same way (with respect to (not) placing logic at the top level. Yair > > Message: 5 > Date: Wed, 6 Jul 2022 13:23:14 +1000 > From: Martin D Kealey

Re: Revisiting Error handling (errexit)

2022-07-05 Thread Yair Lenga
; cat f2 ; cat f3 ; } # 🐈🐈🐈 Catch { echo “bad cat” ; }. # 🐈‍⬛🐈‍⬛🐈‍⬛ Yair. Sent from my iPad > On Jul 6, 2022, at 2:19 AM, Lawrence Velázquez wrote: > > On Tue, Jul 5, 2022, at 6:34 PM, Yair Lenga wrote: >> I probably did not described the intended beha

Re: Revisiting Error handling (errexit)

2022-07-05 Thread Yair Lenga
Sent from my iPad > On Jul 6, 2022, at 1:07 AM, Lawrence Velázquez wrote: > > On Tue, Jul 5, 2022, at 5:18 PM, Yair Lenga wrote: >> I’m not in front of my desktop, so I can not verify behavior, but here >> is my expectation - let me know if it make sense, in the conte

Re: Revisiting Error handling (errexit)

2022-07-05 Thread Yair Lenga
Hi Martin, Thanks for taking the time to review my proposal. Wanted to highlight that the implementation was less than 3 hour (fun) job - no trouble at all. Credit should go to current bash dev team (I am being told it’s a team of 1) - for keeping organized, well written, documented code ! I’m

Re: Revisiting Error handling (errexit)

2022-07-05 Thread Yair Lenga
t;connected" statements. Either create a 'main' function, or create a top level block: On Tue, Jul 5, 2022 at 12:00 AM Lawrence Velázquez wrote: > On Mon, Jul 4, 2022, at 3:55 PM, Yair Lenga wrote: > > I'm sorry - I misunderstood your original comments. I'

Re: bug-bash Digest, Vol 236, Issue 5

2022-07-04 Thread Yair Lenga
dge > To: bug-bash@gnu.org > Subject: Re: Revisiting Error handling (errexit) > Message-ID: > Content-Type: text/plain; charset=us-ascii > >> On Mon, Jul 04, 2022 at 09:33:28PM +0300, Yair Lenga wrote: >> Thanks for taking the time to review my post. I do not want to

Re: Revisiting Error handling (errexit)

2022-07-04 Thread Yair Lenga
Mon, Jul 4, 2022 at 10:00 PM Lawrence Velázquez wrote: > On Mon, Jul 4, 2022, at 2:33 PM, Yair Lenga wrote: > > Thanks for taking the time to review my post. I do not want to start a > > thread about the problems with ERREXIT. > > Neither do I. > > > Instead, I'm

Re: Revisiting Error handling (errexit)

2022-07-04 Thread Yair Lenga
he code for submission/review (style, comments, test cases, ...) as needed. Was not implying for blank approval ;-) Regards, Yair On Mon, Jul 4, 2022 at 7:41 PM Lawrence Velázquez wrote: > On Mon, Jul 4, 2022, at 8:20 AM, Yair Lenga wrote: > > I was able to change Bash source and buil

Revisiting Error handling (errexit)

2022-07-04 Thread Yair Lenga
Hi, In my projects, I'm using bash to manage large scale jobs. Works very well, especially, when access to servers is limited to ssh. One annoying issue is the error handling - the limits/shortcomings of the 'errexit', which has been documented and discussed to the Nth degree in multiple forums.