https://flyte.org logo
#ask-the-community
Title
# ask-the-community
g

Garret Cook

01/02/2024, 4:08 AM
The ShellTask flyte examples (https://docs.flyte.org/projects/cookbook/en/v0.3.66/auto/core/flyte_basics/shell_task.html) describe them running "Bash scripts". However, it appears they are running under /bin/sh instead. How can I switch it to bash?
Copy code
t1 = ShellTask(
    name="task_1",
    debug=True,
    script="""
    set -ex
    set -o pipefail #Bash specific, and fails
    echo "Hey there! Let's run some bash scripts using Flyte's ShellTask."
    """,
    inputs=kwtypes(x=FlyteFile),
    output_locs=[
        OutputLocation(var="i", var_type=FlyteFile, location="{inputs.x}")
    ],
)
I get the following output from the web interface after the task tries to run: /bin/sh: 4: set: Illegal option -o pipefail
k

Ketan (kumare3)

01/02/2024, 5:01 AM
Can you make the first line #!/bin/bash
g

Garret Cook

01/02/2024, 5:37 PM
Thank you for the suggestion. I had the same idea, but it did not change anything.
s

Samhita Alla

01/03/2024, 12:51 PM
i'm able to reproduce. created a PR to add
executable
to `ShellTask`: https://github.com/flyteorg/flytekit/pull/2084. that should let you set the type of the shell you need. you can just say
executable="/bin/bash"
and it should work.