Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Dan Douglas
On Wed, Jul 23, 2014 at 1:29 PM, Chet Ramey chet.ra...@case.edu wrote: On 7/23/14, 3:20 AM, maik.lied...@sungard.com wrote: hello, to change our scripts from ksh to bash we have problems with vars and leading zeros. how we can declare hrs and min? Greg offered several good suggestions to

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Dan Douglas
the very first difference I've ever noticed in zsh between bash and ksh emulations.) -- Dan Douglas

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Dan Douglas
On Wednesday, July 23, 2014 05:44:25 PM Dan Douglas wrote: On Wednesday, July 23, 2014 05:02:42 PM Chet Ramey wrote: ksh93 -c 'echo $(( 010 ))' Oh heh. Maybe a compile-time option or something I'm doing wrong... I always assumed it intentionally violates POSIX. I also just noticed zsh

Re: break exit status

2014-07-06 Thread Dan Douglas
from a function with a RETURN trap set bypasses the trap if break results in jumping out of the function (Yes, I tried that one long ago). -- Dan Douglas

Re: break exit status

2014-07-06 Thread Dan Douglas
On Sunday, July 06, 2014 10:04:17 AM Dan Douglas wrote: Frustratingly I'm pretty sure there isn't even a possible hackish eval or alias workaround. Haha nevermind. I guess Bash in non-POSIX mode expands an aliased done keyword. shopt -s expand_aliases alias done='done; (exit $_status

Re: Possible bug when combining Bash's process substitution with HERE-document?

2014-06-18 Thread Dan Douglas
I've heard process substitutions considerably complicate parsing. zsh and ksh93 are the only others that have process substitutions that I know of, and zsh can't handle unbalanced parentheses in that situation either. $ zsh -c $'cat (cat EOF\n(test)(foo\nEOF\n)' zsh:4: parse error near `(cat

Re: Possible bug when combining Bash's process substitution with HERE-document?

2014-06-18 Thread Dan Douglas
On Wed, Jun 18, 2014 at 2:49 PM, Chet Ramey chet.ra...@case.edu wrote: Yes, since bash can parse the same construct without any problems if you use command substitution, it looks like a bug. I'll take a look. It brings to mind all those unbalanced paren case..esac bugs that affected every

Re: 'time' not recognized as reserved when first word after 'if'

2014-06-10 Thread Dan Douglas
On Tue, Jun 10, 2014 at 8:39 AM, Dale R. Worley wor...@alum.mit.edu wrote: From: Dan Douglas orm...@gmail.com On Mon, Jun 9, 2014 at 7:51 PM, Dale R. Worley wor...@alum.mit.edu wrote: But if I add braces around the condition, 'time' is recognized: That's not too surprising

Re: 'time' not recognized as reserved when first word after 'if'

2014-06-09 Thread Dan Douglas
On Mon, Jun 9, 2014 at 7:51 PM, Dale R. Worley wor...@alum.mit.edu wrote: But if I add braces around the condition, 'time' is recognized: That's not too surprising. That ! is unaffected is. if ! ! time :; then ... is an equivalent but working pipeline. if time { :; }; should also be valid but

Re: Arithmetic + array allows for code injection

2014-05-30 Thread Dan Douglas
of file' unexpected -- Dan Douglas

Re: funcnest and recursion

2014-05-23 Thread Dan Douglas
with Guido, as do many others. Though all the same arguments apply in this case. I see no good reason for an arbitrary limit but I understand the opposing view. -- Dan Douglas

Re: funcnest and recursion

2014-05-23 Thread Dan Douglas
. Glad it's not arbitrarily capped at 1k. $ time dash -c 'f() { echo $1; f $(($1 + 1)); }; f 0' | tail -n 1 13776 real0m0.035s user0m0.020s sys 0m0.033s $ time bash -c 'f() { echo $1; f $(($1 + 1)); }; f 0' | tail -n 1 8308 real0m3.993s user0m4.032s sys 0m0.165s -- Dan

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-11 Thread Dan Douglas
/syntax/expansion/brace#more_fun -- Dan Douglas

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread Dan Douglas
20140517 20140518 20140519 -- Dan Douglas

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread Dan Douglas
On Saturday, May 10, 2014 03:31:05 PM Dan Douglas wrote: $ bash -c 'printf -v a %(%s)T -1; printf %(%Y%m%d)T $a ${a[a+=60*60*24,0]{0..8}}; echo' 20140510 20140511 20140512 20140513 20140514 20140515 20140516 20140517 20140518 20140519 By the way, I'm not very good at remembering

Re: 'local -x VARIABLE' does not clear variable for subprocesses

2014-05-07 Thread Dan Douglas
; } function h { typeset -n ref=$1; echo ${ref-unset}; } f x # should print unset -- Dan Douglas

Re: Indirect parameter access combined with Assign Default Values

2014-05-07 Thread Dan Douglas
' declare -- _; y=foo ++ typeset -p '_; y' + eval 'declare -- _; y=foo' ++ declare -- _ ++ y=foo + echo foo foo -- Dan Douglas

segfault if nameref set on local variable

2014-05-07 Thread Dan Douglas
#21 0x0041f6ee in run_one_command (command=0x7fffd5fe function f { typeset x; typeset -n x; x=y; }; f) at shell.c:1339 #22 0x0041e9e0 in main (argc=3, argv=0x7fffd108, env=0x7fffd128) at shell.c:694 -- Dan Douglas

Re: 'local -x VARIABLE' does not clear variable for subprocesses

2014-05-07 Thread Dan Douglas
On Wednesday, May 07, 2014 10:04:11 AM Chet Ramey wrote: On 5/7/14, 2:10 AM, Dan Douglas wrote: By doesn't shadow you mean that it _does_ hide the global right? Localizing a variable should cover up globals and variables in parent scopes even if they aren't given a value. That seems

Re: segfault if nameref set on local variable

2014-05-07 Thread Dan Douglas
On Wednesday, May 07, 2014 10:58:42 AM Chet Ramey wrote: On 5/7/14, 10:21 AM, Dan Douglas wrote: Another one to do with namerefs. :-) Looks like it's when the target of the ref is local to the same scope. $ gdb -q -ex 'run -c function f { typeset x; typeset -n x; x=y; }; f' ./bash

printf octal literals

2014-05-05 Thread Dan Douglas
be missed. Worked out fine for ECMAScript5 strict.) -- Dan Douglas

Re: printf octal literals

2014-05-05 Thread Dan Douglas
On Monday, May 05, 2014 09:37:27 AM Eric Blake wrote: On 05/05/2014 05:09 AM, Dan Douglas wrote: Just a heads up on something I hadn't noticed: Bash (and dash) treat octal literals in printf precision inconsistently (using glibc -- not sure if it's a bug or GNUism on that end or the shell

Re: 'local -x VARIABLE' does not clear variable for subprocesses

2014-05-04 Thread Dan Douglas
differences that don't have to do with exporting. Test 1 exports a global then localizes it. Test 2 exports a local and tests a local from a child scope. Test 3 tests exported namerefs. -- Dan Douglas

Re: Command name dequote does not work

2014-04-15 Thread Dan Douglas
Not sure we have enough info here. Have you tried set -x to see what's really going on? Have you also confirmed that it isn't actually calling your script and the script simply isn't functioning as expected? -- Dan Douglas

Re: Command name dequote does not work

2014-04-15 Thread Dan Douglas
) + dequote '; evil' + eval printf %s '; evil' evil here -- Dan Douglas

Re: UTF-8 printf string formating problem

2014-04-06 Thread Dan Douglas
'%.3Ls\n' $'\u2605\u2605\u2605\u2605\u2605' ★ Also, zsh does this by default with no special option. I tend to lean towards going by character anyway because that's what most shell features such as read -N do, and most work directly involving the shell is with text not binary data. -- Dan

read portability

2014-03-27 Thread Dan Douglas
and the -A would be very useful even if left undocumented or marked as deprecated. -- Dan Douglas

Re: read portability

2014-03-27 Thread Dan Douglas
On Thu, Mar 27, 2014 at 3:16 AM, Dan Douglas orm...@gmail.com wrote: I have such a function of course, but don't care to make every script depend on it. Oh, and of course I'll still be using the wrapper. This is a feature for my great grandchildren to use once Apple is out of business

Re: easier construction of arrays

2014-03-27 Thread Dan Douglas
I don't believe any shell can currently read nul-delimited input into an array without looping. It's been suggested to add a delimiter to mapfile. It looks like mapfile uses zgetline() to wrap around calls to zread() and doesn't support any delimiter. read(1) on the other hand uses one of the

Re: easier construction of arrays

2014-03-27 Thread Dan Douglas
On Thu, Mar 27, 2014 at 5:05 PM, Mike Frysinger vap...@gentoo.org wrote: thanks, i wasn't aware of that func. that seems like the easiest solution. mapfile it awesome, but for getting find(1) results into an array you should continue to use a read -rd '' loop. read -d is somewhat portable, and

Re: Bug#741402: [bash] Shell functions definitions may require parentheses despite function keyword

2014-03-13 Thread Dan Douglas
it exists isn't clear. There are other alternate syntaxes that are also discouraged, but undocumented, such as the for ((;;)) { ...; } syntax. -- Dan Douglas

Re: Executing 'return' inside RETURN trap causes function to recurse infinitely

2014-03-09 Thread Dan Douglas
On Fri, Mar 7, 2014 at 1:38 PM, Eduardo A. Bustamante López dual...@gmail.com wrote: WARNING: the codes given below cause the shell to enter an infinite loop. Both: dualbus@debian:~$ bash -Tc 'f(){ :; }; trap return RETURN; f' ^C and: dualbus@debian:~$ bash -c 'f(){ trap return RETURN;

Re: DEL character treated specially when preceded by a backslash when used in the RHS of the regex operator ([[ $'\177' =~ $'\\\177' ]])

2014-01-17 Thread Dan Douglas
On Fri, Jan 17, 2014 at 8:07 AM, Greg Wooledge wool...@eeg.ccf.org wrote: On Fri, Jan 17, 2014 at 08:53:07AM -0500, Chet Ramey wrote: On 1/17/14 8:01 AM, Greg Wooledge wrote: I would expect [[ x =~ yx ]] to fail (return 1) every time. There is a question about the correct behavior when y ==

Re: Interpretation of escapes in expansions in pattern matching contexts

2013-09-17 Thread Dan Douglas
On Saturday, April 06, 2013 03:48:55 AM Dan Douglas wrote: Bash (4.2.45) uniquely does interpret such escapes for [[, which makes me think this test should say no: x=\\x; if [[ x == $x ]]; then echo yes; else echo no; fi Here's more data. Some permutations of escaped and quoted

Re: multi-line like C-style comments ( /* code */ ) in bash

2013-09-07 Thread Dan Douglas
a strong desire for this. A good editor should make normal comments painless enough. -- Dan Douglas

Re: -a vs -e

2013-09-06 Thread Dan Douglas
-o and -a are for entertainment. ~ $ bash -c 'set -a; [ -o -a -o -a -o ]; echo $?' 1 ~ $ mksh -c 'set -a; [ -o -a -o -a -o ]; echo $?' 0 ~ $ bash -c '[ -o -a -o -a -o -o ]; echo $?' 0 ~ $ mksh -c 'o=1 [ -o -a -o -a -gt -o ]; echo $?' 0 -- Dan Douglas

Re: Lack of quotes causes IFS to be ignored for ${arr[*]} during assignments

2013-08-29 Thread Dan Douglas
-fun-with-IFS-td11388.html The assignments are all consistent in 4.3. https://gist.github.com/ormaaj/6381747 -- Dan Douglas

Re: Arithmetic assignment side-effects

2013-08-06 Thread Dan Douglas
before the LHS of the +=. There's just no amount of mind-bending I can think of that could make evaluating the += first produce anything other than an error. -- Dan Douglas

Re: Arithmetic assignment side-effects

2013-08-04 Thread Dan Douglas
-- Dan Douglas

Arithmetic assignment side-effects

2013-08-03 Thread Dan Douglas
' [-Wunsequenced] int main() { int x=0; printf(%d\n, x+=x=1); return 0; } ~~ ^ 1 warning generated. 2 -- Dan Douglas

Re: [ast-users] Arithmetic assignment side-effects

2013-08-03 Thread Dan Douglas
On Sunday, August 04, 2013 12:30:48 AM Roland Mainz wrote: On Sun, Aug 4, 2013 at 12:04 AM, Dan Douglas orm...@gmail.com wrote: Is it specified what the value of x should be after this expression? x=0; : $((x+=x=1)) Bash, ksh93, mksh, posh say 1. zsh, dash, busybox say 2. Clang and gcc

Re: Minor bug declaring arrays of integers: dcl -ai=broken, dcl -ia=ok

2013-07-28 Thread Dan Douglas
in any shell provided # you can supply all the necessary workarounds, and they correctly interpret # ksh93 printf %q output (requires $'...'). At least one level of recursive # arithmetic variable evaluation must also be supported. # Dan Douglas orm...@gmail.com namespace main { # e.g. add set

Re: bug batch

2013-07-27 Thread Dan Douglas
with another modifier expands arrays to a single word. fixed. :-) -- Dan Douglas

Re: Minor bug declaring arrays of integers: dcl -ai=broken, dcl -ia=ok

2013-07-22 Thread Dan Douglas
evaluating to whatever expression is stored in x. If you want, you can force it to behave the other way as shown in my first reply. The primary reason I said it isn't a bug is because this has been discussed on the list a few times before and that's been the general consensus. -- Dan Douglas

Re: Minor bug declaring arrays of integers: dcl -ai=broken, dcl -ia=ok

2013-07-21 Thread Dan Douglas
, and doesn't have to do with the order options are supplied in. -- Dan Douglas

Re: Minor bug declaring arrays of integers: dcl -ai=broken, dcl -ia=ok

2013-07-21 Thread Dan Douglas
I even have some code that relies upon this effect. -- Dan Douglas

Re: PS1 multiline with colors

2013-07-09 Thread Dan Douglas
that by using read: read _CRST (tput sgr0) #Reset read _CRed (tput setaf 1) #Red read _CBLD (tput bold) #Bold Can also give all the debug output %q formatting. exec {BASH_XTRACEFD} (set +x; while IFS= read -r x; do printf %q\\n $x; done) -- Dan Douglas

Re: PS1 multiline with colors

2013-07-05 Thread Dan Douglas
This function (colorSet) takes one or more associative array names and can populate it with a few predefined color palates. Written for Bash/ksh93/zsh. http://wiki.bash-hackers.org/snipplets/add_color_to_your_scripts -- Dan Douglas

Re: regex confusion -- not matching; think it should?

2013-06-21 Thread Dan Douglas
On Thu, Jun 20, 2013 at 7:09 AM, Greg Wooledge wool...@eeg.ccf.org wrote: On Wed, Jun 19, 2013 at 06:12:57PM -0500, Dan Douglas wrote: Thanks to mksh, posh, etc not supporting POSIX character classes at all, I'm not so sure it's actually better in practice. (talking about standard shell

Re: regex confusion -- not matching; think it should?

2013-06-19 Thread Dan Douglas
it defined for the POSIX locale. Thanks to mksh, posh, etc not supporting POSIX character classes at all, I'm not so sure it's actually better in practice. (talking about standard shell pattern matching of course) -- Dan Douglas

Re: Aw: Re: currently doable? Indirect notation used w/a hash

2013-06-18 Thread Dan Douglas
printf '%s ' ${!1} echo } a=( '(a b c)' $'([3]=\'(d e f)\' [5]=1 2 3)' '(g h i)' ) # typeset -a a=(([0]=a [1]=b [2]=c) ([3]=([0]=d [1]=e [2]=f) [5]=1 [6]=2 [7]=3) ([0]=g [1]=h [2]=i) ) getElem 'a[1][3][@]' || echo unset -- Dan Douglas

Re: currently doable? Indirect notation used w/a hash

2013-06-14 Thread Dan Douglas
. To validate a parameter name fully requires a full shell parser, because the subscript of an indexed array is effectively a part of its name as far as Bash is concerned. -- Dan Douglas

Re: currently doable? Indirect notation used w/a hash

2013-06-14 Thread Dan Douglas
On Friday, June 14, 2013 06:02:15 AM Dan Douglas wrote: On Monday, June 10, 2013 09:39:56 AM Greg Wooledge wrote: On 10 Jun 2013 14:15, Chris F.A. Johnson ch...@cfajohnson.com wrote: It is not the least bit difficult with eval: eval array=( \\${$1[@]}\ ) On Mon, Jun 10

Re: currently doable? Indirect notation used w/a hash

2013-06-14 Thread Dan Douglas
On Friday, June 14, 2013 02:30:19 PM Pierre Gaston wrote: On Fri, Jun 14, 2013 at 2:25 PM, Dan Douglas orm...@gmail.com wrote: Also forgot to mention (though it should be obvious). $ ~/doc/programs/bash43 -c 'function f { typeset -n x=$1; : $x; }; a=(yo jo); f a[\$(echo yes this even

bug batch

2013-06-13 Thread Dan Douglas
find it. Ignore if so. -- Dan Douglas

Re: Possible bug with BASH V4: The $!

2013-04-11 Thread Dan Douglas
. -- Dan Douglas

Re: Possible bug with BASH V4: The $!

2013-04-11 Thread Dan Douglas
mode -- Dan Douglas

Re: prevent ignore SIGINT for asynchronous commands without enabling job control

2013-04-10 Thread Dan Douglas
://mywiki.wooledge.org/ProcessManagement http://mywiki.wooledge.org/SignalTrap -- Dan Douglas

Re: Very slow pattern substitution in parameter expansion

2013-04-09 Thread Dan Douglas
0m0.000s real0m0.000s user0m0.000s sys 0m0.000s As an aside, don't store commands in variables. http://mywiki.wooledge.org/BashFAQ/050 -- Dan Douglas

Interpretation of escapes in expansions in pattern matching contexts

2013-04-06 Thread Dan Douglas
no, dash says yes 19:33:40 jilles: Bourne shell says no -- Dan Douglas

Re: Interpretation of escapes in expansions in pattern matching contexts

2013-04-06 Thread Dan Douglas
is the default binary name produced by the heirloom build, though I've seen other names used. -- Dan Douglas

Re: Interpretation of escapes in expansions in pattern matching contexts

2013-04-06 Thread Dan Douglas
On Saturday, April 06, 2013 09:37:44 PM Chet Ramey wrote: On 4/6/13 4:48 AM, Dan Douglas wrote: I couldn't find anything obvious in POSIX that implies which interpretation is correct. Assuming it's unspecified. Bash (4.2.45) uniquely does interpret such escapes for [[, which makes me

Re: setvalue builtin command

2013-04-04 Thread Dan Douglas
the most portable way to assign multiple elements to an indexed array other than a separate assignment for each element. - The combination `set -sA' provides a means of sorting (lexicographically). Bash currently has no built-in way to sort an array or the positional parameters. -- Dan Douglas

Re: weird problem -- path interpretted/eval'd as numeric expression

2013-03-28 Thread Dan Douglas
Can you whittle this down to the smallest reproducer and post a stand-alone synthetic testcase with sample input data that fails? If the goal is simulating exported arrays, there are other methods that would probably work out better. -- Dan Douglas

Re: Assignments preceding declare affect brace and pathname expansion.

2013-03-27 Thread Dan Douglas
to not recognize declaration commands (which is unfortunate IMO), then you would expect the 2nd case above to be the same as the 3rd case. Instead, it's not wordsplitting and not failing due to the () metacharacters, and using sort of a hybrid of the two. -- Dan Douglas

typeset +x var to a variable exported to a function doesn't remove it from the environment.

2013-03-25 Thread Dan Douglas
export the variable to the environment in this case, but just localizes it, and requires a separate export.) -- Dan Douglas

Assignments preceding declare affect brace and pathname expansion.

2013-03-25 Thread Dan Douglas
as ordinary assignments nor ordinary expansions. -- Dan Douglas

A few possible process substitution issues

2013-03-25 Thread Dan Douglas
the wait. Process substitutions do set $! in Bash, not in Zsh. -- Dan Douglas

Re: More fun with IFS

2013-03-01 Thread Dan Douglas
be kept as-is. I think the root of the problem is trying to force unquoted $@ to be like $* instead of the other way around. That's how bash (if not for the bug) and ksh93 manage to do this while remaining consistent with the spec. -- Dan Douglas

Re: More fun with IFS

2013-02-28 Thread Dan Douglas
that's an excellent strategy. :) -- Dan Douglas

Re: More fun with IFS

2013-02-26 Thread Dan Douglas
On Sunday, February 24, 2013 10:26:52 PM Thorsten Glaser wrote: Dan Douglas dixit: Zsh and pdkshes produce: one:::two:three:::four For all of the above, which I think is wrong for the last 4. ksh93 produces: Why is it incorrect? This test was intended to demonstrate expansions

Re: cd -e returns syntax error

2013-02-23 Thread Dan Douglas
On Sunday, February 24, 2013 02:43:03 PM Chris Down wrote: Hi all, Unless I'm misunderstanding how it should work, `cd -P -e' does not work as specified by the documentation. From `help cd': Yep, see: http://lists.gnu.org/archive/html/bug-bash/2013-01/msg00099.html -- Dan Douglas

Re: builtin read -d behaves differently after set -e#

2013-02-06 Thread Dan Douglas
until one of the most recent alphas. I take it that this is sort of an extra special feature that most shells with -d happen to share, and not merely a necessary consequence of -d with an empty arg. Hopefully someday `mapfile' will inherit an analogous feature. -- Dan Douglas

Re: More fun with IFS

2013-01-30 Thread Dan Douglas
On Wednesday, January 30, 2013 11:35:55 AM Chet Ramey wrote: On 1/30/13 2:47 AM, Dan Douglas wrote: No, $* always expands to a single word. If multiple words result, those are the result of field-splitting, not an intrinsic multi-word expansion as in the case of $@. Though POSIX

Re: Short list of issues with various expansions and IFS

2013-01-29 Thread Dan Douglas
-document, which might make the issue not so straightforward). -- Dan Douglas

More fun with IFS

2013-01-29 Thread Dan Douglas
Zsh and pdkshes produce: one:::two:three:::four For all of the above, which I think is wrong for the last 4. ksh93 produces: one:::two three:::four for the last 4, which I think is correct. -- Dan Douglas

Re: More fun with IFS

2013-01-29 Thread Dan Douglas
On Wednesday, January 30, 2013 02:00:26 AM Chris F.A. Johnson wrote: On Wed, 30 Jan 2013, Dan Douglas wrote: Hi everyone, and welcome to another edition of IBOTD (IFS-bug-of-the-day), featuring everyone's favorite Bourne shell kludge: word-splitting! On today's episode - inconsistencies

Re: | in bash?

2013-01-19 Thread Dan Douglas
On Saturday, January 19, 2013 02:47:38 PM Chet Ramey wrote: On 1/18/13 4:10 PM, Dan Douglas wrote: In scripts it breaks POSIX, conflicts with the coproc operator in kshes, applies the redirections in an unintuitive order since the same operator redirects stdout first, then applies

Re: | in bash?

2013-01-18 Thread Dan Douglas
|. -- Dan Douglas

Re: about one feature in V4.2 against V4.1

2013-01-15 Thread Dan Douglas
=20 x=: POSIXLY_CORRECT=; while printf %s ${x:--) }; ((n--)); do x= ${x:-true ${x:=:}}; done ) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) -- Dan Douglas

Re: about one feature in V4.2 against V4.1

2013-01-15 Thread Dan Douglas
Oops nevermind, I see the issue now. Couldn't reproduce here either. Neither with compat modes nor the real versions. -- Dan Douglas

Re: $(echo x' '{1, 2}') performs brace expansion, even though it should not

2013-01-14 Thread Dan Douglas
that means to inhibit brace expansion subst.c - brace_expand_word_list: suppress brace expansion for words with W_NOBRACE flag -- Dan Douglas

Re: Reverse redirection / assignment order

2013-01-13 Thread Dan Douglas
On Sunday, January 13, 2013 04:54:59 PM Chet Ramey wrote: On 1/9/13 2:00 PM, Dan Douglas wrote: When expanding simple commands, steps 3 and 4 are reversed unconditionally for all command types and number of words expanded, even in POSIX mode. http://pubs.opengroup.org/onlinepubs

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-12 Thread Dan Douglas
Yes some use -u / -e for debugging apparently. Actual logic relying upon those can be fragile of course. I prefer when things return nonzero instead of throwing errors usually so that they're handleable. -- Dan Douglas

Re: printf %q represents null argument as empty string.

2013-01-12 Thread Dan Douglas
On Friday, January 11, 2013 10:39:19 PM Dan Douglas wrote: On Saturday, January 12, 2013 02:35:34 AM John Kearney wrote: BTW, your wrappers won't work. A wrapper would need to implement format Hrmf I should have clarified that I only meant A complete printf wrapper would be difficult

Assignment errors with no additional words expanded in non-POSIX mode fails to abort

2013-01-11 Thread Dan Douglas
: value too great for base (error token is 8#9) post Only applies to non-POSIX mode. -- Dan Douglas signature.asc Description: This is a digitally signed message part.

printf %q represents null argument as empty string.

2013-01-11 Thread Dan Douglas
. -- Dan Douglas signature.asc Description: This is a digitally signed message part.

Re: printf %q represents null argument as empty string.

2013-01-11 Thread Dan Douglas
On Friday, January 11, 2013 09:39:00 PM John Kearney wrote: Am 11.01.2013 19:38, schrieb Dan Douglas: $ set --; printf %q\\n $@ '' printf should perhaps only output '' when there is actually a corresponding empty argument, else eval $(printf %q ...) and similar may give

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-11 Thread Dan Douglas
On Friday, January 11, 2013 09:48:32 PM John Kearney wrote: Am 11.01.2013 19:27, schrieb Dan Douglas: Bash treats the variable as essentially undefined until given at least an empty value. $ bash -c 'typeset -i x; [[ -v x ]]; echo $?, ${x+foo}; typeset -p x' 1, bash: line

Re: printf %q represents null argument as empty string.

2013-01-11 Thread Dan Douglas
On Friday, January 11, 2013 04:37:56 PM Chet Ramey wrote: On 1/11/13 4:05 PM, Dan Douglas wrote: I don't understand what you mean. The issue I'm speaking of is that printf %q produces a quoted empty string both when given no args and when given one empty arg. A quoted

Re: printf %q represents null argument as empty string.

2013-01-11 Thread Dan Douglas
format specifiers which act like they were given a null or zero argument if more formats than arguments are given. We already had pretty much this same discussion here: http://lists.gnu.org/archive/html/bug-bash/2012-12/msg00083.html It somehow slipped my mind. -- Dan Douglas

Some segfaults possible via mapfile callbacks

2013-01-09 Thread Dan Douglas
fault There were others, mostly to do with modifying the variable being mapped. -- Dan Douglas signature.asc Description: This is a digitally signed message part.

Reverse redirection / assignment order

2013-01-09 Thread Dan Douglas
# ... ...# Everything else same as dash I don't know why this order was chosen or what the advantages to one over the other might be. -- Dan Douglas signature.asc Description: This is a digitally signed message part.

Short list of issues with various expansions and IFS

2013-01-09 Thread Dan Douglas
, error) } } #endif - else if (expandable_redirection_filename (temp)) + else if (0) { expandable_filename: if (posixly_correct interactive_shell == 0) -- Dan Douglas signature.asc Description: This is a digitally signed message part.

Re: Segmentation fault in arithmetical expression when mixing array variables.

2013-01-09 Thread Dan Douglas
)) )# No error $ ( y=(1 2); (( _ = y[0], _ = 1 )) ) # crash Segmentation fault $ ( y=(1 2); (( _ = y[0] )) ) # No error lvalue doesn't matter. It's just any two assignments in which the first dereferences an array with an index given. -- Dan Douglas

Re: Question about the return value of 'local'

2012-12-14 Thread Dan Douglas
paragraphs are word-for-word identical between Bash and multiple other manuals. Best bet is to learn to navigate it quickly. -- Dan Douglas

Re: RFE: printf '%(fmt)T' prints current time by default

2012-12-14 Thread Dan Douglas
be evaluated as if a zero argument were supplied. Ooh ok... hrm I didn't consider it's actually consistent with everything else this way. -- Dan Douglas

Re: shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread Dan Douglas
strings with even length, while +(???) matches those with odd length. +(?) matches any string with at least one character, and any number of ?'s matches multiples of that length. $ ksh -c 'printf %R\\n \?' ^.$ $ ksh -c 'printf %R\\n +(?)' ^(.)+$ $ ksh -c 'printf %R\\n +(??)' ^(..)+$ -- Dan Douglas

Re: shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread Dan Douglas
On Thursday, December 13, 2012 09:25:02 PM DJ Mills wrote: +(???) matches lengths that are multiples of 3, not all odd-length files. ?+(??) would match odd-length files. My bad :) -- Dan Douglas

Requesting an alternate nameref feature

2012-12-12 Thread Dan Douglas
around overloaded variable names in outer scopes, except would allow both reading and writing to any scope from any deeper scope (provided the reference itself hasn't been covered up). This would be extremely useful for shell libraries. -- Dan Douglas

<    1   2   3   >