Re: cannot declare local variables if they're readonly

2015-07-23 Thread isabella parakiss
On 7/23/15, Chet Ramey wrote: > This is an excellent time to point out that it's to everyone's advantage > to be as complete as possible when describing a problem on the list, > rather than revealing additional details one at a time. > > There's no way anyone would have guessed that you were encou

Re: cannot declare local variables if they're readonly

2015-07-23 Thread Chet Ramey
On 7/23/15 10:57 AM, isabella parakiss wrote: > On 7/23/15, Greg Wooledge wrote: >> People who use "readonly" are generally doing so in the context of a >> "restricted shell" (yes, commence laughter) or other situation where >> that specific variable is the key to unlocking something that the >> a

Re: Segfault in save_bash_input. Array index is out of a range.

2015-07-23 Thread Chet Ramey
On 7/22/15 5:00 PM, Alexey Makhalov wrote: > I have met situation when nfd(returned by fcntl) is 217, but nbuffers is > only 25 > > if (buffers[nfd]) > { > /* What's this? A stray buffer without an associated open file > descriptor? Free up the buffer and report the error. *

Re: echo redirect additional new line

2015-07-23 Thread Hans Ginzel
On Thu, Jul 23, 2015 at 11:01:46AM -0400, Greg Wooledge wrote: echo 2>"c\nd" Did you intend to write the number "2" to a file, or did you intend to redirect stderr? ... The space after the 2 is extremely significant, and $'...' is how you create strings (filenames, etc.) with control characters

Re: cannot declare local variables if they're readonly

2015-07-23 Thread Greg Wooledge
On Thu, Jul 23, 2015 at 04:57:42PM +0200, isabella parakiss wrote: > The fact is, I found out this by using BASH_REMATCH, trying to use it in > different functions without interfering with each other. Ah! That changes things. :) imadev:~$ [[ x =~ y ]] imadev:~$ declare -p BASH_REMATCH declare -a

Re: echo redirect additional new line

2015-07-23 Thread Greg Wooledge
On Thu, Jul 23, 2015 at 03:41:13PM +0200, Hans Ginzel wrote: > Hello! > > Consider, please, this small script > > echo 1 > echo 1>"a b" > echo 2 > echo 2>"c\nd" Did you intend to write the number "2" to a file, or did you intend to redirect stderr? > Why is there the additional new line between

Re: cannot declare local variables if they're readonly

2015-07-23 Thread isabella parakiss
On 7/23/15, Greg Wooledge wrote: > People who use "readonly" are generally doing so in the context of a > "restricted shell" (yes, commence laughter) or other situation where > that specific variable is the key to unlocking something that the > administrator does not want the user to unlock. The

echo redirect additional new line

2015-07-23 Thread Hans Ginzel
Hello! Consider, please, this small script echo 1 echo 1>"a b" echo 2 echo 2>"c\nd" echo 3 echo 3>"`echo -e 'e\nf'`" echo 4 The output is 1 2 3 4 Why is there the additional new line between 2 and 3 or 3 and 4 respectively. bash --version GNU bash, version 4.3.11(1)-release (i686-pc-linux-g

Re: cannot declare local variables if they're readonly

2015-07-23 Thread Chet Ramey
On 7/22/15 7:12 PM, isabella parakiss wrote: > From variables.c > >The test against old_var's context > level is to disallow local copies of readonly global variables (since I > believe that this could be a security hole). > > Can you please expla

Re: cannot declare local variables if they're readonly

2015-07-23 Thread Stephane Chazelas
2015-07-23 01:12:01 +0200, isabella parakiss: > From variables.c > >The test against old_var's context > level is to disallow local copies of readonly global variables (since I > believe that this could be a security hole). > > Can you please expl

Re: cannot declare local variables if they're readonly

2015-07-23 Thread Greg Wooledge
On Thu, Jul 23, 2015 at 01:12:01AM +0200, isabella parakiss wrote: > From variables.c > >The test against old_var's context > level is to disallow local copies of readonly global variables (since I > believe that this could be a security hole). >