Re: Not operator (~) fail on arithmetic expansion.

2016-11-28 Thread Chet Ramey
On 11/27/16 12:33 PM, Bize Ma wrote: > Bash Version: 4.4 > Patch Level: 5 > Release Status: release > > Description: > The ~ operator is called not, and does a one's complement of the > following value. That works correctly with > >$ echo $(( ~1 )) >-2 > > Even with > >$

Re: Not operator (~) fail on arithmetic expansion.

2016-11-28 Thread Eric Blake
On 11/27/2016 11:54 PM, L A Walsh wrote: > Does ~ get home dirs for UID's? I thought it only worked > for usernames? I would think that allowing user names that were > all numeric would be confusing for software that accept either UID's or > usernames. Can usernames even begin with a number? Sa

Re: Not operator (~) fail on arithmetic expansion.

2016-11-28 Thread Greg Wooledge
On Sun, Nov 27, 2016 at 09:54:59PM -0800, L A Walsh wrote: > Does ~ get home dirs for UID's? I thought it only worked > for usernames? imadev:~$ id uid=563(wooledg) gid=22(pgmr) groups=1002(webauth),208(opgmr) imadev:~$ echo ~563 ~563

Re: Not operator (~) fail on arithmetic expansion.

2016-11-28 Thread Andreas Schwab
On Nov 28 2016, John McKown wrote: > Not replying for Chet, who will have the definitive answer, I will say that > I, personally, think that is working as designed. ~ 0 (with space between) > is definitely the "not" operator. But without the middle space, ~0, where > there is a white space charac

Re: Not operator (~) fail on arithmetic expansion.

2016-11-27 Thread L A Walsh
John McKown wrote: Not replying for Chet, who will have the definitive answer, I will say that I, personally, think that is working as designed. ~ 0 (with space between) is definitely the "not" operator. But without the middle space, ~0, where there is a white space character in front of the

Re: Not operator (~) fail on arithmetic expansion.

2016-11-27 Thread Eduardo Bustamante
Except that this is *inside* arithmetic context. Bash is definitely doing something wrong here: dualbus@hp:~$ for sh in bash zsh ksh93 mksh dash posh; do $sh -c 'echo $0 $((~0))' $sh; done bash: /home/dualbus: syntax error: operand expected (error token is "/home/dualbus") zsh -1 ksh93 -1 mksh -1

Re: Not operator (~) fail on arithmetic expansion.

2016-11-27 Thread John McKown
Not replying for Chet, who will have the definitive answer, I will say that I, personally, think that is working as designed. ~ 0 (with space between) is definitely the "not" operator. But without the middle space, ~0, where there is a white space character in front of the tilde, looks to me like t