# Can I set --optimize flag when calling script

**URL:** <https://discourse.julialang.org/t/can-i-set-optimize-flag-when-calling-script/102217>\
**Category:** General Usage\
**Tags:** question, scripting\
**Created:** [July 28, 2023, 10:37pm UTC](https://discourse.julialang.org/t/can-i-set-optimize-flag-when-calling-script/102217 "2023-07-28T22:37:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Post date:** [July 28, 2023, 10:37pm UTC](https://discourse.julialang.org/t/can-i-set-optimize-flag-when-calling-script/102217/1 "2023-07-28T22:37:47Z")

</div>

If I call a script with `./script.jl` (crucially, not `julia script.jl`) can I still set the `-O` flag somehow? Passing it in after the file name doesn’t seem to work.

---

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [July 28, 2023, 10:46pm UTC](https://discourse.julialang.org/t/can-i-set-optimize-flag-when-calling-script/102217/2 "2023-07-28T22:46:28Z")

</div>

What platform? If your script begins with a shebang, you can add options there. See e.g.

> <https://stackoverflow.com/questions/16549357/is-it-possible-to-include-command-line-options-in-the-python-shebang>

---

<div class="post-metadata">

**Author:** ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Post date:** [July 28, 2023, 10:47pm UTC](https://discourse.julialang.org/t/can-i-set-optimize-flag-when-calling-script/102217/3 "2023-07-28T22:47:49Z")

</div>

Thanks!  
It does indeed begin with a shebang. Can I vary the optimization level used? I.e. sometimes calling it with `-O0` and other times `-O3`?

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [July 29, 2023, 1:43am UTC](https://discourse.julialang.org/t/can-i-set-optimize-flag-when-calling-script/102217/4 "2023-07-29T01:43:38Z")

</div>

> Thanks!  
> It does indeed begin with a shebang. Can I vary the optimization level used? I.e. sometimes calling it with `-O0` and other times `-O3` ?

Please tell us what platform you are using

1 Windows  
2 Linux  
3 Mac
