Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSH too lenient in parsing the ! operator, e.g. ! true | ! false #2091

Open
andychu opened this issue Oct 5, 2024 · 0 comments
Open

OSH too lenient in parsing the ! operator, e.g. ! true | ! false #2091

andychu opened this issue Oct 5, 2024 · 0 comments

Comments

@andychu
Copy link
Contributor

andychu commented Oct 5, 2024

from https://gist.github.com/izabera/7dcece1d6df9063d43d2b3b0a222e7bb

https://lobste.rs/s/hv0agk/short_bash_quiz


mksh is also too lenient, but other shells agree with bash

$ bash -n -c 'true | ! false; echo $?'
bash: -c: line 1: syntax error near unexpected token `!'
bash: -c: line 1: `true | ! false; echo $?'


andy@hoover:~/git/oilshell/oil$ mksh -n -c 'true | ! false; echo $?'


andy@hoover:~/git/oilshell/oil$ yash -n -c 'true | ! false; echo $?'
yash -c:1: syntax error: `!' cannot be used as a command name


andy@hoover:~/git/oilshell/oil$ bin/osh -n -c 'true | ! false; echo $?'
(command.CommandList
  children: [
    (command.Sentence

@andychu andychu changed the title OSH too lenient in parsing ! OSH too lenient in parsing the ! operator, e.g. ! true | ! false Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant