Re: function name bug ?
2008/7/31 Paul Jarc [EMAIL PROTECTED] christophe malvasio [EMAIL PROTECTED] wrote: cbz (){ echo why 'cbz' not a valid function name ?;} bash: syntax error near unexpected token `(' It works for me. What does alias cbz say for you? paul alias work are you in x86 ?
Re: [bash-3.2.39] race condition on AIX when using libtool with bash
On Wed, 2008-07-30 at 18:53 +0200, Michael Haubenwallner wrote: snip Now I can see (stripped the unimportant): open(GetWMCMapW.loT, O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE) = 4 kfcntl(4, 14, 0x0001) = 1 close(4)= 0 open(/tmp//sh-thd-1217607265, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE) = 4 kfcntl(4, F_DUPFD, 0x) = 5 kwrite(5, p i c _ o b j e c t = '.., 32) = 32 close(5)= 0 open(/tmp//sh-thd-1217607265, O_RDONLY|O_LARGEFILE) = 5 close(4)= 0 unlink(/tmp//sh-thd-1217607265) = 0 kfcntl(5, 14, 0x) = 0 close(5)= 0 execve(/usr/bin/cat, 0x200234E8, 0x20026968) argc: 1 argv: cat kread(0, p i c _ o b j e c t = '.., 4096) = 32 kwrite(1, p i c _ o b j e c t = '.., 32) = 32 kread(0, p i c _ o b j e c t = '.., 4096) = 0 close(1)= 0 _exit(0) So I'm sure the missing commands above _are_ executed. My speculation: 1) bash opens the here-document twice, first O_WRONLY, second O_RDONLY, dup2'ing the second handle to stdin before doing exec('cat'), removing the file immediately after the second open. 2) ksh opens the here-document only once, with O_RDWR, and dup's that handle to stdin before doing exec('cat'), removing the file immediately after the open. Forgot to mention that ksh does fseek() to zero before exec(cat). Could one think of: when opening the file the second time, the content of the first write isn't on-disk yet (because the content might fit into some aix write buffer), or already removed by someone else in the meantime, or something like that? Sorry, I've been wrong here: cat actually _can_ read the content, so the double-open is not the problem here. Although IMHO it still might be better for security and performance reasons to open() only once, and fseek() to zero like ksh does. /haubi/ -- Michael Haubenwallner Gentoo on a different level
Re: function name bug ?
christophe malvasio wrote: cbz (){ echo why 'cbz' not a valid function name ?;} bash: syntax error near unexpected token `(' It works for me. What does alias cbz say for you? alias work He wants to know if you probably have an alias named cbz defined, not if your alias engine works. J.
Re: set -x output of test operator is irretating
Chet Ramey wrote: Toralf Förster wrote: I'm wondering why in the example (see below) the right side is prefixed with a '\' wheras the left side is unchanged. ... [EMAIL PROTECTED] ~ $ echo 1 2 3 4 | while read a b c d; do [[ $a = $b || $a = $c || $a = $d ]] echo oops; done + read a b c d + echo '1 2 3 4' + [[ 1 = \2 ]] + [[ 1 = \3 ]] + [[ 1 = \4 ]] Because the ==/!=/= operators are defined to match the rhs as a pattern unless it's quoted. You quoted the original string, and the `set -x' output is supposed to be re-usable as input, so the trace output is quoted appropriately. Of course that makes sense for the == and != cases. But is that true even for the = case? For the = case I thought it was STRING1 = STRING2 and not STRING = PATTERN. Could you clarify the rules and educate us? Thanks Bob
Re: set -x output of test operator is irretating
Bob Proulx wrote: Chet Ramey wrote: Toralf Förster wrote: I'm wondering why in the example (see below) the right side is prefixed with a '\' wheras the left side is unchanged. ... [EMAIL PROTECTED] ~ $ echo 1 2 3 4 | while read a b c d; do [[ $a = $b || $a = $c || $a = $d ]] echo oops; done + read a b c d + echo '1 2 3 4' + [[ 1 = \2 ]] + [[ 1 = \3 ]] + [[ 1 = \4 ]] Because the ==/!=/= operators are defined to match the rhs as a pattern unless it's quoted. You quoted the original string, and the `set -x' output is supposed to be re-usable as input, so the trace output is quoted appropriately. Of course that makes sense for the == and != cases. But is that true even for the = case? For the = case I thought it was STRING1 = STRING2 and not STRING = PATTERN. When the == and != operators are used, the string to the right of the operator is considered a pattern [...] From the description for [[ ]]. = and == should make have difference in behaviour. J.
Re: set -x output of test operator is irretating
Jan Schampera wrote: = and == should make have difference in behaviour. should not show differences *suh* Sorry J.
One cant insert a single quote into a variable with built-in substitution.
Hello I've tried to insert a single quote into a variable content. With something like this : bash-3.2$ foo=bar bash-3.2$ echo ${foo/%/'} If you look at that, you understand that is the $PS2, so it means that bash is interpreting the single quote a special char. So, naturally, I've told myself : just escape it. And I've tried that : bash-3.2$ foo=bar bash-3.2$ echo ${foo/%/\'} bar\' But... what the hell ? The backslash belongs to the variable now ? So, I cant use it as is, and if I escape it, the command doesnt do what I want anymore.. Is that some kind of bug in the parser ? I've tested that on my fedora 9, with a brand new : GNU bash, version 3.2.33(1)-release (x86_64-redhat-linux-gnu) But the same behaviour happens on an old old debian sarge with GNU bash, version 2.05b.0(1)-release (x86_64-pc-linux-gnu) D -- Damien Nadé [EMAIL PROTECTED] Tel : +33 (0) 4 93 16 88 24 GPG Key ID : 8E279021