Shell script invokation through bazel

78 views
Skip to first unread message

Lekshmi R

unread,
Jan 28, 2025, 7:25:26 AM1/28/25
to bazel-discuss
Hello,
I would like to integrate shell script in bazel . I have used sh_binary for this . But I have few arguments also to pass to the script .But I could not add the arguments needed for this ?
Does anyone know how to pass arguments to shell script invoked via sh_binary in bazel


Regards,
Lekshmi

Filip Filmar

unread,
Jan 28, 2025, 12:38:15 PM1/28/25
to Lekshmi R, bazel-discuss

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bazel-discuss/a718f529-9e65-43f7-bcad-e9511a93cd38n%40googlegroups.com.

Jared Neil

unread,
Jan 30, 2025, 12:43:41 PM1/30/25
to bazel-discuss
If you want to save the arguments in the BUILD.bazel file, then the `args` attribute is what you want. If you're trying to pass additional flags to the script as part of the `bazel run`, you need to add a `--` so Bazel knows to stop parsing any args that start with a `-`.
For example:
bazel run //some:target arg1 arg2
bazel run //some:target -- --script_flag flag1
Reply all
Reply to author
Forward
0 new messages