Re: Avoid asterisk expansion when it selects "everything"

2016-04-13 Thread Mike Frysinger
On 13 Apr 2016 11:23, Anis ELLEUCH wrote: > I would like to ask if it is possible to disable expanding asterisk when it > selects all entries ? > > `$ rm * .jpg` with a mistaken space between asterisk and .jpg will delete > everything in your home directory or in the entire disk. > > In my opinio

Re: Avoid asterisk expansion when it selects "everything"

2016-04-13 Thread Bob Proulx
Anis ELLEUCH wrote: > I would like to ask if it is possible to disable expanding asterisk when it > selects all entries ? You ask if it is possible and the answer is no it is not possible. Because the shell expands the "*" before it passes the result as arguments to the rm command. The rm command

Re: Leak in BASH "named" file descriptors?

2016-04-13 Thread Chet Ramey
On 4/13/16 9:34 AM, Pierre Gaston wrote: > For me the value is in 1) not hard coding the number and 2) being able to > use more explicit names (eg "logfile" rather than "3"), nothing more. If you limit the effects to those two, it's not a compelling feature to add. In practice, the first is not

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Greg Wooledge
On Wed, Apr 13, 2016 at 03:28:02PM +0100, Stephane Chazelas wrote: > 2016-04-13 08:55:16 -0400, Greg Wooledge: > [...] > > > And if you want to keep eventual spurious characters after the > > > last NL character in the file: > > > > > > while IFS= read -r line; do printf '%s\n' "$line"; done < tes

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Stephane Chazelas
2016-04-13 08:55:16 -0400, Greg Wooledge: [...] > > And if you want to keep eventual spurious characters after the > > last NL character in the file: > > > > while IFS= read -r line; do printf '%s\n' "$line"; done < test.txt > > [ -z "$line" ] || printf %s "$line" > > Another way to write that is

Re: Leak in BASH "named" file descriptors?

2016-04-13 Thread George
> On 4/13/16 1:54 AM, George Caswell wrote: > > Personally, I don't think it makes sense for a redirection on a command to > > persist beyond the scope of that command. A redirection with a > > dynamically-assigned fd is basically equivalent to a redirection to a > > numbered fd. > > Then why have

Avoid asterisk expansion when it selects "everything"

2016-04-13 Thread Anis ELLEUCH
Hello everybody, I would like to ask if it is possible to disable expanding asterisk when it selects all entries ? `$ rm * .jpg` with a mistaken space between asterisk and .jpg will delete everything in your home directory or in the entire disk. In my opinion, when the user asks to select "every

Re: Leak in BASH "named" file descriptors?

2016-04-13 Thread Pierre Gaston
On Wed, Apr 13, 2016 at 3:51 PM, Chet Ramey wrote: > On 4/13/16 1:54 AM, George Caswell wrote: > > > Personally, I don't think it makes sense for a redirection on a command > to > > persist beyond the scope of that command. A redirection with a > > dynamically-assigned fd is basically equivalent

Re: Leak in BASH "named" file descriptors?

2016-04-13 Thread Chet Ramey
On 4/13/16 1:54 AM, George Caswell wrote: > Personally, I don't think it makes sense for a redirection on a command to > persist beyond the scope of that command. A redirection with a > dynamically-assigned fd is basically equivalent to a redirection to a > numbered fd. Then why have it? There's

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Greg Wooledge
On Wed, Apr 13, 2016 at 01:43:42PM +0100, Stephane Chazelas wrote: > 2016-04-13 08:10:15 +0200, Geir Hauge: > [...] > > while read -r line; do echo "$line"; done < test.txt > > > > though printf should be preferred over echo: > > > > while read -r line; do printf '%s\n' "$line"; done < te

Re: Memory leak in hc_erasedups

2016-04-13 Thread Chet Ramey
On 4/12/16 9:49 PM, Seiichi Ishitsuka wrote: > Hi all, > > I found memory leak in case of using "HISTCONTOL=erasedups" in bash-4.2. Thanks for the report. This will be fixed in the next release of bash. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Stephane Chazelas
2016-04-13 08:10:15 +0200, Geir Hauge: [...] > while read -r line; do echo "$line"; done < test.txt > > though printf should be preferred over echo: > > while read -r line; do printf '%s\n' "$line"; done < test.txt [...] Actually, you also need to empty $IFS while IFS= read -r line; do

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Greg Wooledge
On Wed, Apr 13, 2016 at 06:49:51AM -0500, John McKown wrote: > ???Ah. Thanks. I only use BASH and the GNU infrastructure, so I have never > run into that problem. I think I'll change my habits, just in case I run > across a system which doesn't have it (especially in my scripts) Every implementati

Re: bash "while do echo" can't function correctly

2016-04-13 Thread John McKown
On Wed, Apr 13, 2016 at 6:45 AM, Pierre Gaston wrote: > > > On Wed, Apr 13, 2016 at 2:34 PM, John McKown > wrote: > >> On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote: >> >> ​... >> >> >>> though printf should be preferred over echo: >>> >>> while read -r line; do printf '%s\n' "$line"; d

Re: bash "while do echo" can't function correctly

2016-04-13 Thread Pierre Gaston
On Wed, Apr 13, 2016 at 2:34 PM, John McKown wrote: > On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote: > > ​... > > >> though printf should be preferred over echo: >> >> while read -r line; do printf '%s\n' "$line"; done < test.txt >> > > ​I've never read about using printf in preference t

Re: bash "while do echo" can't function correctly

2016-04-13 Thread John McKown
On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote: ​... > though printf should be preferred over echo: > > while read -r line; do printf '%s\n' "$line"; done < test.txt > ​I've never read about using printf in preference to echo. Why is that? ​I have used it myself in special cases, such a

Re: Leak in BASH "named" file descriptors?

2016-04-13 Thread George Caswell
> On 1/27/16 1:18 PM, Mathieu Patenaude wrote: > >  > > When using "named" file descriptors inside a function, the file descriptors > > are not automatically un-linked when the function returns, but when using > > regular "numbered" file descriptors they are automatically "destroyed". >  > Yes.  Th