@Adrian Oprea great video and that really helps eliminate a lot of questions. The result of this part of the command
$(ps -ef | grep -v grep | grep kibana | wc -l)
...does not appear to match when executed in the bash prompt versus the nifi environment. You might want to run only that part of the command in your script to see what it says in the attribute in NiFi. Also, you might want to ensure you're running in the shell you expect. You might want to have
#!/bin/bash
At the top of the script, for example.