4

I'm writing "scripts" in Julia, that I use from the command line. For example:

#!/usr/bin/env julia

@info "Hello world!"

Using a shebang line like this makes it possible to make such a script executable and easily run it without explicitly invoking julia:

$ ./hello
[ Info: Hello world!

However, passing additional command-line arguments to julia in such a shebang line is not portable (at least does not work for Linux, which I care about). Is there a way to overcome this limitation? For example, how could I make sure that my script will be run with julia -O0 --compile=min?

1 Answer 1

4

The recommended way to do this is documented in the FAQ. Adapting the example to your case:

#!/bin/bash
#=
exec julia -O0 --compile=min "${BASH_SOURCE[0]}" "$@"
=#

@info "Hello world!"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.