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

ocaml -e 'Printf.printf "hello\n"' #6631

Closed
vicuna opened this issue Oct 27, 2014 · 3 comments
Closed

ocaml -e 'Printf.printf "hello\n"' #6631

vicuna opened this issue Oct 27, 2014 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Oct 27, 2014

Original bug ID: 6631
Reporter: berenger
Assigned to: @gasche
Status: closed (set by @gasche on 2017-03-03T16:10:27Z)
Resolution: duplicate
Priority: normal
Severity: feature
Category: toplevel
Tags: patch, junior_job
Duplicate of: #5232
Monitored by: @hcarty

Bug description

I think the perl interpreter has a -e switch which allows to create
one liners in Perl.
I'd be quite happy if my interpreter of choice (ocaml) would allow
such option, in order to encourage me to put more ocaml one liners
in my bash scripts, when I am forced to do some bash scripting. :)
'-e' stands for evaluate, I guess.

File attachments

@vicuna
Copy link
Author

vicuna commented Oct 27, 2014

Comment author: @hcarty

The '-open' flag makes a lot of sense in this context as well.

@vicuna
Copy link
Author

vicuna commented Oct 27, 2014

Comment author: @gasche

Note that

echo 'Printf.printf "hello\n"' | ocaml -stdin

is a fairly reasonable workaround.

camlp4 has a "-str " option for the same purpose, which is indeed fairly useful.

@vicuna
Copy link
Author

vicuna commented Mar 3, 2017

Comment author: @gasche

The patch is not good enough (for example it creates a temporary file but never deletes it, littering the user's filesystem with useless source files), but in 5232 I never got feedback from the original contributor.

I'm closing this issue as a duplicate of 5232, which has the better command-line name (-str rather than -e).

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

2 participants