Re: Bash 5.0-alpha tries to expand exclamation marks in quoted strings

2018-06-20 Thread Chet Ramey
On 6/20/18 6:29 PM, Bernhard Rosenkraenzer wrote: > I don't think this is intentional: > > [bero@c64 ~]$ echo "test!!" > echo "testecho "testecho "test!""" > testecho testecho test! It's impossible to say whether or not this is correct without knowing what's in your history. Double quotes don't

Bash 5.0-alpha tries to expand exclamation marks in quoted strings

2018-06-20 Thread Bernhard Rosenkraenzer
I don't think this is intentional: [bero@c64 ~]$ echo "test!!" echo "testecho "testecho "test!""" testecho testecho test! ttyl bero

Re: propagating environment variable via internal command

2018-06-20 Thread Tomas Janousek
Hi Chet and Tomáš, On Wed, Jun 20, 2018 at 10:42:07AM -0400, Chet Ramey wrote: > On 6/20/18 9:25 AM, Tomáš Čech wrote: > >  $ /bin/sh > >  sh-4.4$ VARIABLE=value set -o noglob > >  sh-4.4$ env | grep VARIABLE > >  VARIABLE=value > >  sh-4.4$ > > Posix requires this behavior, which dates back to

Re: $OPTIND varibale value is different from sh

2018-06-20 Thread Chet Ramey
On 6/20/18 2:09 PM, Martijn Dekker wrote: > Op 20-06-18 om 13:39 schreef Greg Wooledge: >> I really don't understand what you're doing here, either.  The only >> use of OPTIND is after the final call to getopts, when there are no >> more options to process.  At that point, OPTIND tells you how

Re: $OPTIND varibale value is different from sh

2018-06-20 Thread Martijn Dekker
Op 20-06-18 om 17:45 schreef Ilkka Virta: $ for sh in dash 'busybox sh' bash ksh93 zsh ; do printf "%-10s: " "$sh"; $sh -c 'while getopts abcd opt; do printf "$OPTIND  "; done; printf "$OPTIND  "; shift $(($OPTIND - 1)); echo "$1" ' sh -a -bcd hello; done dash  : 2  3  3  3  3  hello

Re: $OPTIND varibale value is different from sh

2018-06-20 Thread Martijn Dekker
Op 20-06-18 om 13:39 schreef Greg Wooledge: I really don't understand what you're doing here, either. The only use of OPTIND is after the final call to getopts, when there are no more options to process. At that point, OPTIND tells you how many times you have to "shift" to get rid of all the

Re: $OPTIND varibale value is different from sh

2018-06-20 Thread Ilkka Virta
On 20.6. 15:39, Greg Wooledge wrote: On Wed, Jun 20, 2018 at 05:16:48PM +0900, Hyunho Cho wrote: set -- -a -bc hello world getopts abc opt "$@" getopts abc opt "$@" # bash = b, 2 <-- different from "sh" echo $opt, $OPTIND# sh = b, 3 Since

Re: Variables can’t contain NUL

2018-06-20 Thread Clark Wang
On Wed, Jun 20, 2018 at 10:22 PM, George wrote: > > Personally I do think some method of handling arbitrary binary data in the > shell would be a welcome addition (and I think zsh provides that - don't > remember if ksh does) > Ksh93 has "typeset -b" which defines vars for binary data (actually

Re: propagating environment variable via internal command

2018-06-20 Thread Chet Ramey
On 6/20/18 9:25 AM, Tomáš Čech wrote: > Hi, > > > when comparing strange behaviors of different shell implementations Tomas > Janousek found this bug > > When using BASH as sh shell... > >  $ ls -l /bin/sh >  lrwxrwxrwx 1 root root 4 Jun 13 16:25 /bin/sh -> bash > > ...internal shell command

Re: Variables can’t contain NUL

2018-06-20 Thread George
On Sun, 2018-05-20 at 04:56 +0200, Garreau, Alexandre wrote: > On 2015-11-13 at 07:17, Greg Wooledge wrote: > Actually in the most general case, where those output streams may > contain NUL bytes, it requires two temp files, because you can't store > arbitrary data streams in bash variables at

propagating environment variable via internal command

2018-06-20 Thread Tomáš Čech
Hi, when comparing strange behaviors of different shell implementations Tomas Janousek found this bug When using BASH as sh shell... $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Jun 13 16:25 /bin/sh -> bash ...internal shell command `set' propagates environment variable to the process its

Re: $OPTIND varibale value is different from sh

2018-06-20 Thread Greg Wooledge
On Wed, Jun 20, 2018 at 05:16:48PM +0900, Hyunho Cho wrote: > set -- -a -bc hello world > > echo $OPTIND# sh, bash = 1 > > getopts abc opt "$@" > echo $opt, $OPTIND # sh, bash = a, 2 > > getopts abc opt "$@" # bash = b, 2 <-- >

$OPTIND varibale value is different from sh

2018-06-20 Thread Hyunho Cho
if $OPTIND value start from 1 then i think "-b" $OPTIND should be "3" like sh but bash print "2" set -- -a -bc hello world echo $OPTIND# sh, bash = 1 getopts abc opt "$@" echo $opt, $OPTIND # sh, bash = a, 2 getopts abc opt "$@" # bash = b, 2