Re: Tilde expansion during command search

2014-07-23 Thread lolilolicon
On Wed, Jul 23, 2014 at 11:00 PM, lolilolicon wrote: > On Wed, Jul 23, 2014 at 10:43 PM, Eric Blake wrote: >> But we are talking about the case where ~ IS quoted during >> the assignment, and only bash then re-expands it during path lookup. > > That's my point. Let me try quoting this again, > >

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 notice

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

2014-07-23 Thread Dan Douglas
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 interprets it in bash and sh mode but not ksh or zsh mode. (it's t

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

2014-07-23 Thread Chet Ramey
On 7/23/14, 4:49 PM, Dan Douglas wrote: > I don't believe there are any cases in which ksh interprets a leading > zero, at least not current versions. If you want octal you must use > either 8#num or typeset -ibase. Same applies to both zsh and mksh > AFAICT. $ ksh93 -c 'echo $(( 010 ))' 8 Posix

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 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 force b

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

2014-07-23 Thread Chet Ramey
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 force base 10 in certain situations. > or can we disable the automa

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

2014-07-23 Thread Greg Wooledge
On Wed, Jul 23, 2014 at 07:20:01AM +, maik.lied...@sungard.com wrote: > how we can declare hrs and min? > or can we disable the automatic change from decimal to octal? Strip the leading zeroes, or force base 10 with 10#$foo inside the math context. > TIME="08:09" Using all-caps variables is

leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Maik.Liedtke
hello, to change our scripts from ksh to bash we have problems with vars and leading zeros. how we can declare hrs and min? or can we disable the automatic change from decimal to octal? leading zeros ignored by perl, ksh. not bash cannnot declare vars hrs and min as decimal only user@host:/ho

Re: Tilde expansion during command search

2014-07-23 Thread lolilolicon
On Wed, Jul 23, 2014 at 10:43 PM, Eric Blake wrote: > But we are talking about the case where ~ IS quoted during > the assignment, and only bash then re-expands it during path lookup. That's my point. Let me try quoting this again, Note that the tildes are expanded during the assignment to P

Re: Tilde expansion during command search

2014-07-23 Thread Eric Blake
On 07/23/2014 08:38 AM, Eric Blake wrote: > On 07/23/2014 08:08 AM, lolilolicon wrote: >> >From this page: http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html >> >> Note that the tildes are expanded during the assignment to PATH, not >> when PATH is accessed during command search.

Re: Tilde expansion during command search

2014-07-23 Thread Eric Blake
On 07/23/2014 08:08 AM, lolilolicon wrote: > On Wed, Jul 23, 2014 at 9:58 PM, Eric Blake wrote: >> >> Might be worth asking the POSIX folks if it is allowed by POSIX. What >> do other shells do? > >>From this page: http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html > > Note that th

Re: Array name expansion in bash-4.3

2014-07-23 Thread Chet Ramey
On 7/22/14, 1:24 PM, Corentin Peuvrel wrote: > Hello, > > I think I found a bug in bash-4.3. > > An example should be self-explanatory : > > bash-4.2 : > $ arr=( idx1 idx2 ) > $ i=arr[1] > $ echo ${!i} > idx2 > $ echo ${!i/x/X} > idX2 > > bash-4.3 : > $ arr=( idx1 idx2 ) > $ i=arr[1] > $ echo $

Re: Tilde expansion during command search

2014-07-23 Thread lolilolicon
On Wed, Jul 23, 2014 at 9:58 PM, Eric Blake wrote: > > Might be worth asking the POSIX folks if it is allowed by POSIX. What > do other shells do? >From this page: http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html Note that the tildes are expanded during the assignment to PATH, no

Re: Tilde expansion during command search

2014-07-23 Thread Dan Douglas
On Wednesday, July 23, 2014 07:58:26 AM Eric Blake wrote: > On 07/23/2014 07:51 AM, Dan Douglas wrote: > > On Wednesday, July 23, 2014 09:28:02 AM you wrote: > >> On 7/23/14, 8:22 AM, Dan Douglas wrote: > >>> Hi, from this discussion: > >>> > >>> https://github.com/koalaman/shellcheck/issues/195#is

Re: Tilde expansion during command search

2014-07-23 Thread Eric Blake
On 07/23/2014 07:51 AM, Dan Douglas wrote: > On Wednesday, July 23, 2014 09:28:02 AM you wrote: >> On 7/23/14, 8:22 AM, Dan Douglas wrote: >>> Hi, from this discussion: >>> >>> https://github.com/koalaman/shellcheck/issues/195#issuecomment-49678200 >>> >>> I can't find any reference that says subst

Re: Tilde expansion during command search

2014-07-23 Thread Dan Douglas
On Wednesday, July 23, 2014 09:28:02 AM you wrote: > On 7/23/14, 8:22 AM, Dan Douglas wrote: > > Hi, from this discussion: > > > > https://github.com/koalaman/shellcheck/issues/195#issuecomment-49678200 > > > > I can't find any reference that says substituting a literal tilde in PATH > > should

Re: Tilde expansion during command search

2014-07-23 Thread Chet Ramey
On 7/23/14, 8:22 AM, Dan Douglas wrote: > Hi, from this discussion: > > https://github.com/koalaman/shellcheck/issues/195#issuecomment-49678200 > > I can't find any reference that says substituting a literal tilde in PATH > should occur during command search. Bash has always done this, even bac

Tilde expansion during command search

2014-07-23 Thread Dan Douglas
Hi, from this discussion: https://github.com/koalaman/shellcheck/issues/195#issuecomment-49678200 I can't find any reference that says substituting a literal tilde in PATH should occur during command search. $ ( cd ~ mkdir tmpdir echo $'#!/bin/sh\necho "Hello from ${BASH_SOURCE}!"'