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

command-line arg processing is broken #472

Closed
StefanKarpinski opened this issue Feb 27, 2012 · 7 comments
Closed

command-line arg processing is broken #472

StefanKarpinski opened this issue Feb 27, 2012 · 7 comments
Labels
kind:bug Indicates an unexpected problem or unintended behavior

Comments

@StefanKarpinski
Copy link
Sponsor Member

bash$ julia -e 'for x in ARGS; println(x); end' foo bar
-e
for x in ARGS; println(x); end
foo
bar
could not open file foo

The -e and 'for x in ARGS; println(x); end' should not be included in ARGS and it should not try to load foo as a source file when the -e flag is used.

@JeffBezanson
Copy link
Sponsor Member

Are the trailing foo and bar just an error then?

@JeffBezanson
Copy link
Sponsor Member

Because what about

julia -e '1' -e '2'

?

@StefanKarpinski
Copy link
Sponsor Member Author

They're not an error: they should be passed into the program via ARGS.

@StefanKarpinski
Copy link
Sponsor Member Author

Having any -e flags should turn off processing the following args as programs and turn on putting them into ARGS.

@JeffBezanson
Copy link
Sponsor Member

Does that mean you can't have multiple -e flags? Not a problem really, since you can use ;.

@StefanKarpinski
Copy link
Sponsor Member Author

I don't think so. Perl allows multiple -e options:

bash$ perl -e 'print("$_\n") for @ARGV;' -e foo bar
bar

@JeffBezanson
Copy link
Sponsor Member

Another example:

$ perl -e 'print("$_\n") for @ARGV;' baz -e foo bar
baz
-e
foo
bar

We just have to put this logic in client.j, no big deal.

nolta pushed a commit to nolta/julia that referenced this issue Mar 3, 2012
fix JuliaLang#472 (command line arguments are broken)
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants