Re: the context of expansion for output redirection
Lewis Hyatt wrote: > Hello- > > I was somewhat surprised to see the following behavior (this is 3.1.17): > > $ x=0; /bin/echo > /tmp/$((++x)); echo $x > 0 > $ x=0; echo > /tmp/$((++x)); echo $x > 1 > > I guess in the first case the expansion of $((++x)) is taking place after > forking, whereas in the second case there is no forked process so the > expansion > happens in the context of the current shell. I would have thought that both > cases would output "1", though. Is this expected or documented anywhere? > Thanks > very much. The Bash philosophy has always been that redirections are carried out in the same context as the command they are part of. That means that a command that causes a subshell to be created will have its redirections performed in that subshell environment. Similarly for builtin commands in the current shell context. 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/
Completion: menu-complete from second TAB hit onwards
Hi everyone, I'm trying to get a specific completion behaviour (simple but effective). Any help would be greatly appreciated. Here is what I'm looking for: 1. When TAB is hit once, complete the command-line with the longest common prefix AND list all possible completions (at the same time). This can be easily achieved by putting 'set show-all-if-ambiguous' in ~/.inputrc. 2. If TAB is hit again after that, then cycle through the possible completions (that is insert the next full match each time TAB is pressed). Obviously, I cannot bind TAB to menu-complete cause I would lose 1. It's actually the exact same behaviour you get with 'set wildmode=list:longest,full' in Vim. I found a lot of articles dealing with how to get Bash-like completion in Vim, but none discussing the opposite. Thanks for taking the time to read my request. -- View this message in context: http://www.nabble.com/Completion%3A-menu-complete-from-second-TAB-hit-onwards-tp25672712p25672712.html Sent from the Gnu - Bash mailing list archive at Nabble.com.