Why is this executed inside a subshell?
Consider the following program: #!/usr/local/bin/bash --norc export VAR=A function setvar { VAR=B echo X } V=$(setvar) echo $VAR When I execute it, I get as result A, not B, as I had expected. If setvar would be an external program, I would understand the result, as this would have to be run in a subshell; but it is a shell function, and shell functions are supposed to be evaluated in the context of the current environment. But it seems that within a $(...), even shell functions are executed in a child process. Is this supposed to work that way? Ronald, using bash 2.05b. -- Ronald Fischer (phone +49-89-63676431) mailto:[EMAIL PROTECTED] ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Bug?
Hi ppl I't bug? [steck(~)]$ bash --version GNU bash, version 3.1.10(1)-release (i386-portbld-freebsd6.1) Copyright (C) 2005 Free Software Foundation, Inc. [steck(~)]$ cd / [steck(/)]$ cd // [steck(//)]$ pwd // [steck(//)]$ -- PGP Public Key: http://steck.wormhole.ru/steck.asc ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
readline post-hook?
Is there a way to run a function after the user has finished a line with RETURN to add characters to the readline buffer? Of course one could malloc new memory and copy the stuff got by the call of readline but may be there is a more smart way of doing it? Thanks for your help! Sebastian ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Why is this executed inside a subshell?
Com MN PG P E B Consultant 3 [EMAIL PROTECTED] wrote: But it seems that within a $(...), even shell functions are executed in a child process. Is this supposed to work that way? Yes. $() passes the output of the inner command to the outer shell via a pipe, with the inner command running in a separate process. paul ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Hidden files feature request
Uno Engborg wrote: In Gnome, MacOS-X, and in Kubuntu KDE, you can make a file hidden from the desktop environment by listing it in a file called .hidden. The .hidden file resides in the same directory as the files to be hidden, and lists the files to be hidden as one file/line. Files hidden by being listed in .hidden should behave like any other dot file. E.g. they should be listed with ls -a It would be nice if the bash shell used the same extended mechanism for creating hidden files. Honoring the .hidden mechanism would allow for a more consitent user experiece for peoople switching back and forth between GUI and CLI environments. To fill in some context here for everyone not following kde-usability: There is a discussion (http://lists.kde.org/?t=11639338162) about localizing and/or hiding the ~/Desktop folder. Why we would want to do this in the shell (in light of the 'power user' comments) I do not know. In fact, I have no idea why you would want .hidden to be obeyed for CLI (vs GUI) purposes. Anyway, Uno, if you are talking about 'ls', your comments are properly addressed to the coreutils lists, bug-coreutils AT gnu DOT org. And I will be very surprised if they are willing to entertain such an idea. Doing it in the GUI is one thing. Doing it in the CLI world is another matter entirely, since you must obey POSIX, and I would guess that such behavior would violate POSIX and cause all sorts of problems besides. -- Matthew This message will self destruct in five millennia. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Bug?
~Steck~ wrote: I't bug? [steck(~)]$ bash --version GNU bash, version 3.1.10(1)-release (i386-portbld-freebsd6.1) Copyright (C) 2005 Free Software Foundation, Inc. [steck(~)]$ cd / [steck(/)]$ cd // [steck(//)]$ pwd // [steck(//)]$ Please read the Bash FAQ, question E10. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Why is this executed inside a subshell?
Com MN PG P E B Consultant 3 wrote: Consider the following program: #!/usr/local/bin/bash --norc export VAR=A function setvar { VAR=B echo X } V=$(setvar) echo $VAR When I execute it, I get as result A, not B, as I had expected. Posix requires that command substitution be executed in a subshell environment. It forbids changes to the subshell environment affecting the calling shell's environment. The way to do that is to run command substitutions in an actual subshell and communicate via pipes. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: readline post-hook?
Sebastian Tannert wrote: Is there a way to run a function after the user has finished a line with RETURN to add characters to the readline buffer? Of course one could malloc new memory and copy the stuff got by the call of readline but may be there is a more smart way of doing it? There is no hook to do it, but you could always write a function to do so and bind it to newline. After doing what you want, just call rl_newline from your custom function to have the normal readline end-of-line processing done. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/ ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
FIGNORE behaviour with 'CVS', version 3.1.17(1)-release (i486-pc-linux-gnu)
From: [EMAIL PROTECTED] To: bug-bash@gnu.org,[EMAIL PROTECTED] Subject: FIGNORE=CVS behaviour, v3.1.17(1)-release Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux relentless 2.6.17-10-386 #2 Fri Oct 13 18:41:40 UTC 2006 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 3.1 Patch Level: 17 Release Status: release Description: When I set FIGNORE to 'CVS' it doesn't work as I believe it's meant to. Pressing tab in a directory containing files still lists 'CVS' in the completion list. However, having just 'VS' as the value for FIGNORE works. Repeat-By: wotan$ ls ApplicationServlet.java CVS/Home.javaOperation.java Session.java Component.java field/ ISequencer.java Page.java Sketch.java wotan$ export FIGNORE=CVS wotan$ cd Ctab causes the next two lines where it should complete Component.java? Component.java CVS/ wotan$ cd Cctrl+C wotan$ export FIGNORE=VS wotan$ cd Component.java The last line completed successfully from a capital C + tab. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash