Re: echo '-e' doesn't work as expected, or does it?

2012-01-23 Thread Ralf Goertz
Philip wrote:

> Hi! Short question this time..
> 
> $ echo '-e'
> does not print -e
> 
> $ echo '-e '
> does print -e .

By the way, neither -e nor -E are explained in the option section of
„help echo“. Only -n is mentioned there.

GNU bash, Version 4.2.10(1)-release (x86_64-suse-linux-gnu)




Re: echo '-e' doesn't work as expected, or does it?

2012-01-23 Thread Pierre Gaston
On Mon, Jan 23, 2012 at 11:47 AM, Ralf Goertz
 wrote:
> Philip wrote:
>
>> Hi! Short question this time..
>>
>> $ echo '-e'
>> does not print -e
>>
>> $ echo '-e '
>> does print -e .
>
> By the way, neither -e nor -E are explained in the option section of
> „help echo“. Only -n is mentioned there.
>
> GNU bash, Version 4.2.10(1)-release (x86_64-suse-linux-gnu)
>

you might want to report a bug to suse, here i get:

 echo $BASH_VERSION;help echo
4.2.10(1)-release
echo: echo [-neE] [arg ...]
Write arguments to the standard output.

Display the ARGs on the standard output followed by a newline.

Options:
  -ndo not append a newline
  -eenable interpretation of the following backslash escapes
  -Eexplicitly suppress interpretation of backslash escapes
...



Re: echo '-e' doesn't work as expected, or does it?

2012-01-23 Thread Andreas Schwab
Pierre Gaston  writes:

> On Mon, Jan 23, 2012 at 11:47 AM, Ralf Goertz
>  wrote:
>> Philip wrote:
>>
>>> Hi! Short question this time..
>>>
>>> $ echo '-e'
>>> does not print -e
>>>
>>> $ echo '-e '
>>> does print -e .
>>
>> By the way, neither -e nor -E are explained in the option section of
>> „help echo“. Only -n is mentioned there.
>>
>> GNU bash, Version 4.2.10(1)-release (x86_64-suse-linux-gnu)
>>
>
> you might want to report a bug to suse, here i get:

It's a bug in --enable-separate-helpfiles: the generated file contains
only one help string for echo, which happens to be the one for !V9_ECHO.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Re: Bash readline remap ESC insert/command mode key

2012-01-23 Thread Roger
> On Sun, Jan 22, 2012 at 04:52:06PM -0500, Chet Ramey wrote:
>On 1/22/12 7:35 AM, Roger wrote:
>>> On Sat, Jan 21, 2012 at 09:17:32PM -0500, Chet Ramey wrote:
>>>
>>> I could look at putting in some sort of inter-character timeout, but I
>>> don't know yet how well the code structure lends itself to that.
>
>Pretty easily, as it turns out.  The attached patch adds a half-second
>timeout to the key sequence code.  Please let me know whether or not it
>works for you.

Patch seems to work great and I can now type 'exit' without command mode
being spawned when typing the 'i'.

It's behaviour is almost identical to VIM's.

A little more indepth examination, and I can see VIM's wait is approximately 
double of what the readline patch's wait time is.  However, I think the shorter 
wait time is more functional as when typing a double char, it in no way takes 
as long as VIM's wait time unless you type the same char with your finger and 
then use a toe to type the second char.

Matter of fact, I'm starting to find VIM's long wait time length a little 
annoying.  ;-)

Great job at guessing the wait time!

-- 
Roger
http://rogerx.freeshell.org/



Re: Bash readline remap ESC insert/command mode key

2012-01-23 Thread Chris Jones
On Mon, Jan 23, 2012 at 08:52:17AM EST, Roger wrote:

[..]

> Matter of fact, I'm starting to find VIM's long wait time length
> a little annoying.  ;-)

:h tm
:h ttm

CJ



Variable undefines - bug or feature?

2012-01-23 Thread Denis Melnikov
Hi,
after the following fragment of code named variable gets empty:

ls | while read file ; do
  v=1
  break
done
echo $v

Is it a bug or a feature?
GNU bash, version 4.1.2(1)-release

Denis



Re: Variable undefines - bug or feature?

2012-01-23 Thread DJ Mills
On Mon, Jan 23, 2012 at 2:58 PM, Denis Melnikov  wrote:
> Hi,
> after the following fragment of code named variable gets empty:
>
> ls | while read file ; do
>  v=1
>  break
> done
> echo $v
>
> Is it a bug or a feature?
> GNU bash, version 4.1.2(1)-release
>
> Denis
>

Pipelines create subshells. See http://mywiki.wooledge.org/BashFAQ/024

As an aside, never parse ls. Simply use a glob.



Re: Bash readline remap ESC insert/command mode key

2012-01-23 Thread Chet Ramey
On 1/23/12 8:52 AM, Roger wrote:

> A little more indepth examination, and I can see VIM's wait is approximately 
> double of what the readline patch's wait time is.  However, I think the 
> shorter 
> wait time is more functional as when typing a double char, it in no way takes 
> as long as VIM's wait time unless you type the same char with your finger and 
> then use a toe to type the second char.
> 
> Matter of fact, I'm starting to find VIM's long wait time length a little 
> annoying.  ;-)
> 
> Great job at guessing the wait time!

Thanks.  Half a second seemed right.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Variable undefines - bug or feature?

2012-01-23 Thread Chet Ramey
On 1/23/12 2:58 PM, Denis Melnikov wrote:
> Hi,
> after the following fragment of code named variable gets empty:
> 
> ls | while read file ; do
>   v=1
>   break
> done
> echo $v
> 
> Is it a bug or a feature?
> GNU bash, version 4.1.2(1)-release

All components of a pipeline generally run in separate processes.  A
child process can't affect its parent.  If you upgrade to bash-4.2, look
at the `lastpipe' option to run the last component in the parent shell
process.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Bash readline remap ESC insert/command mode key

2012-01-23 Thread Roger
> On Mon, Jan 23, 2012 at 04:52:17AM -0900, Roger wrote:
>> On Sun, Jan 22, 2012 at 04:52:06PM -0500, Chet Ramey wrote:
>>On 1/22/12 7:35 AM, Roger wrote:
 On Sat, Jan 21, 2012 at 09:17:32PM -0500, Chet Ramey wrote:

 I could look at putting in some sort of inter-character timeout, but I
 don't know yet how well the code structure lends itself to that.
>>
>>Pretty easily, as it turns out.  The attached patch adds a half-second
>>timeout to the key sequence code.  Please let me know whether or not it
>>works for you.
>
>Patch seems to work great and I can now type 'exit' without command mode
>being spawned when typing the 'i'.
>
>It's behaviour is almost identical to VIM's.

Found a bug.

Think this timing patch is omitting readline support on reverse history search. 
 
ie:

 and try typing "ping"

The display will only show "png"


There seems to be more then one spot the timing patch needs to apply.

-- 
Roger
http://rogerx.freeshell.org/



Re: Cross compile crapout

2012-01-23 Thread Chet Ramey
On 1/23/12 1:12 AM, Jonathan Andrews wrote:

> I needed a statically linked bash for testing an arm board. I did not
> expect it to be nearly 3MB though ! It surprises me that a statically
> linked bash is bigger than the entire busybox binary i've compiled, or
> my kernel image for that matter. Is this bloat gcc, some failing of the
> linker or bash itself?  

That's probably the size of the C library on your machine.  The only
difference between a static bash and a `normal' bash is that the system
libraries are linked in instead of being dynamically linked at run time.

I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X,
where static linking isn't possible), and it ended up being about half
as big as a bash-4.2.20 build.  I had to fix a few things to do it.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Cross compile crapout

2012-01-23 Thread Jonathan Andrews
On Mon, 2012-01-23 at 20:30 -0500, Chet Ramey wrote:
> On 1/23/12 1:12 AM, Jonathan Andrews wrote:
> 
> > I needed a statically linked bash for testing an arm board. I did not
> > expect it to be nearly 3MB though ! It surprises me that a statically
> > linked bash is bigger than the entire busybox binary i've compiled, or
> > my kernel image for that matter. Is this bloat gcc, some failing of the
> > linker or bash itself?  
> 
> That's probably the size of the C library on your machine.  The only
> difference between a static bash and a `normal' bash is that the system
> libraries are linked in instead of being dynamically linked at run time.
Im not a gcc expect, I thought the idea of the linker was also to drop
unused code but this seems not to be true with gcc as default.  

http://www.google.com/url?sa=t&rct=j&q=gcc%20linker%20unused%20code&source=web&cd=5&ved=0CEYQFjAE&url=http%3A%2F%2Felinux.org%2Fimages%2F2%2F2d%2FELC2010-gc-sections_Denys_Vlasenko.pdf&ei=Tx8eT5mUGczRswaZju3eDA&usg=AFQjCNF3miTnzqYNsiiyei_SQDlDxG10TQ&cad=rja

http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html

I've been trying to compile bash static with the extra parameters, no
joy so far - finger trouble on my part I expect.


> I built a minimal bash (--enable-minimal-config) on my machine (Mac OS X,
> where static linking isn't possible), and it ended up being about half
> as big as a bash-4.2.20 build.  I had to fix a few things to do it.
Maybe this is one of the things ?

I've applied the patches, tried this :

(script)
export CC=arm-softfloat-linux-gnu-gcc
./configure --build=i386-linux --host=arm-linux --enable-static-link 
--without-bash-malloc --enable-minimal-config
make


Get this :

arm-softfloat-linux-gnu-gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"arm"' 
-DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"arm-unknown-linux-gnu"' 
-DCONF_VENDOR='"unknown"' -DLOCALEDIR='"/usr/local/share/locale"' 
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g 
-O2 -c y.tab.c
./parse.y: In function 'shell_getc':
./parse.y:2399: error: label 'pop_alias' used but not defined
make: *** [y.tab.o] Error 1


Any ideas ?

Thanks,
Jon