Re: An alias named `done` breaks for loops

2021-08-17 Thread L A Walsh
On 2021/08/14 17:05, Kerin Millar wrote: On Sat, 14 Aug 2021 15:59:38 -0700 George Nachman wrote: This does not constitute a valid test case for two reasons. Firstly, aliases have no effect in scripts unless the expand_aliases shell option is set. 1) I frequently use for loops in

Re: An alias named `done` breaks for loops

2021-08-16 Thread Ilkka Virta
On Sun, Aug 15, 2021 at 2:00 AM George Nachman wrote: > Defining an alias named `done` breaks parsing a for loop that does not have > an `in word` clause. > alias done="" > Works for me: $ set -- a b c $ alias done='echo hi; done' $ for x do done hi hi hi Not that I think it's a good idea to

Re: An alias named `done` breaks for loops

2021-08-14 Thread Oğuz
On Sun, Aug 15, 2021 at 1:59 AM George Nachman wrote: > `done` should not be considered a simple command in the context where it > would terminate a for loop. Alternately, prevent the user from creating > aliases that will cause problems like this. There already is an alias substitution rule for

Re: An alias named `done` breaks for loops

2021-08-14 Thread Lawrence Velázquez
On Sat, Aug 14, 2021, at 6:59 PM, George Nachman wrote: > Description: > Defining an alias named `done` breaks parsing a for loop that does not have > an `in word` clause. > > > Repeat-By: > > Run the following script. It fails with this error: > > myscript.bash: line 7: syntax error near unexp

Re: An alias named `done` breaks for loops

2021-08-14 Thread Kerin Millar
On Sat, 14 Aug 2021 15:59:38 -0700 George Nachman wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: darwin20.5.0 > Compiler: gcc > Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security > uname output: Darwin Georges-Mac-Pro.local 20.5.

An alias named `done` breaks for loops

2021-08-14 Thread George Nachman
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: darwin20.5.0 Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Darwin Georges-Mac-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-