Execute bash script in Shell Task

Hello Everyone!
I prepared simple bash script (job.sh) with python.

#!/bin/bash
python - <<‘END_SCRIPT’
file_result = r’result.txt’
k = ‘Hello everyone. It is test message’
with open(file_result, ‘a’) as f:
f.write(k + ‘\n’)
END_SCRIPT

In Terminal it works correct but I can’t execute bash script in Flowable. I didn’t find Information how I can correct Shell Task fill in.

Please, help.

Thanks!

The shell task passes the script to the OS, so if it works on the terminal it should work from the model. Can you share the XML of the shell step?

Sorry for late response, I was in Vacation.
I would like to a little bit changed my Question.
At this moment I prepared new “Form”, uploaded bash Script to this Form and now I hope bash Script available for Execution.
How I can make it? Use Groovy or JavaScript for execution bash Script?

I haven’t tried it, but doesn’t the shell task accepts an expression for the shell script? That way, you can pass it as a variable.

I tried to make it from shell task:
1.I prepared User Task with “Upload” Panel in Form and uploaded shell script “job.sh”

  1. Next, I prepared Schell Task with Parametrs
    Command: chmod
    Argument1: +x
    Argument2: job.sh

  2. Next I prepared Schell Task with Parametrs
    Command: sh
    Argument1: job.sh

Afterwards, I run this Process, everything is fine, without Errors, but I didn’t receive correct Result (file result.txt). You can see it from my code above.

What was wrong? How fill in shell task correct that I can get correct result?