Re: bug-bash

2018-02-08 Thread Eduardo Bustamante
On Thu, Feb 8, 2018 at 4:23 PM, Nolan <4030...@gmail.com> wrote: > I have found a 'result' of a command that cannot be a feature. > > Enter command, command executes, prints exit at the prompt. > > Goes to next line in terminal showing the "#" prompt. > > A "whoami" says root. > > Is this known? >

bug-bash

2018-02-08 Thread Nolan
I have found a 'result' of a command that cannot be a feature. Enter command, command executes, prints exit at the prompt. Goes to next line in terminal showing the "#" prompt. A "whoami" says root. Is this known? Do you need screen captures of my terminal session? Nolan

Re: Quoting and string comparison

2018-02-08 Thread Jaan Vajakas
Stupid me, everything makes sense now. Thanks for explaining and sorry for the trouble! 2018-02-08 19:56 GMT+01:00 Ilkka Virta : > On 8.2. 15:05, Jaan Vajakas wrote: > >> Hi! >> >> I noticed a weird behavior. Is it a bug? >> >> Namely, why does >> >> echo "$(for f in a b c; do if [[ \"$f\" > b ]

Re: Quoting and string comparison

2018-02-08 Thread Ilkka Virta
On 8.2. 15:05, Jaan Vajakas wrote: Hi! I noticed a weird behavior. Is it a bug? Namely, why does echo "$(for f in a b c; do if [[ \"$f\" > b ]]; then echo "$f > b"; else echo "$f <= b"; fi; done)" If I'm not mistaken, what you're doing is essentially this: $ for f in '"a"' '"b"' '"c"'; do i

Re: Quoting and string comparison

2018-02-08 Thread Pierre Gaston
On Thu, Feb 8, 2018 at 4:27 PM, Jaan Vajakas wrote: > So should Bash report a syntax error? > You do not have a syntax error, the rules for quoting inside $( ) are the same as outside, whether you use outside quotes "$( )" or not So in your case you are escaping the double quotes and concatena

Re: Quoting and string comparison

2018-02-08 Thread Jaan Vajakas
So should Bash report a syntax error? 2018-02-08 15:24 GMT+01:00 Clark Wang : > On Thu, Feb 8, 2018 at 9:05 PM, Jaan Vajakas > wrote: > >> Hi! >> >> I noticed a weird behavior. Is it a bug? >> >> Namely, why does >> >> echo "$(for f in a b c; do if [[ \"$f\" > b ]]; then echo "$f > b"; else >> e

Re: Quoting and string comparison

2018-02-08 Thread Clark Wang
On Thu, Feb 8, 2018 at 9:05 PM, Jaan Vajakas wrote: > Hi! > > I noticed a weird behavior. Is it a bug? > > Namely, why does > > echo "$(for f in a b c; do if [[ \"$f\" > b ]]; then echo "$f > b"; else > echo "$f <= b"; fi; done)" > Should be: echo "$(for f in a b c; do if [[ $f > b ]]; then e

Quoting and string comparison

2018-02-08 Thread Jaan Vajakas
Hi! I noticed a weird behavior. Is it a bug? Namely, why does echo "$(for f in a b c; do if [[ \"$f\" > b ]]; then echo "$f > b"; else echo "$f <= b"; fi; done)" output a <= b b > b c > b ? I would have expected the same output as one of echo "$(for f in a b c; do if [[ "$f" > b ]]; then ech