I possibly posted this in the wrong forum section as I thought this is more a general question but it seems I was wrong. In search for a solution to instruct Knime respectively your bash Node to use the actual PATH pariable, I wonder if you could shed some light onto this?
Googling around to adjust the Eclipse Path variable I could not come to a solution (please see my prev. comment). Do you happen to have an idea?
I haven’t continue working on the awk issue but with the recently gained knowledge I might do that. Though, that project I worked on back then was closed (I switched employers). For the sake of interest – and to satisfy my German urge to do things right – I might come back to this in the future.
About the environment I printed the variables in a previous comment. When chekcing the env vars in terminal they differ from those available in Knime. Therefore, i suspect that Knime is using another configuration file.
However, I could not find anything. Even by declaring the PATH variable in the knime.ini it did not changed anything. The HOME and SHEEL Variables are identical, though. Therefore, I thought it’s using the same bash which I confirmed via
which bash true false
Setting the absolute directory for the command not found by first identifying the executable “/usr/local/bin” via (in terminal):
which nmap true false
Did not resolve the command not found issue.
Creating a .bash_profile and declaring the PATH variable, applying via source .bash_profile, didn’t resolve it either. I assume Eclipse / Knime is spun up in a separate user / config or so not utilizing the system nor my actual user configuration (to the full extend).
it appears that the $PATH declaration made by a user in either .bash_profile or .zshrc (the profile for zsh) has no effect on the PATH established by the Bash node.
for this reason, any executable residing outside of that path variable definition is not found.
for some reason, variables (which use the “$” character) are not recognized, so one is prevented from executing either a temporary addition to the path or a ‘permanent’ change to the profile
At this point, I’ve all but given up. My last effort will be to determine whether the conda environment that prevails when I try to use the Bash node might have some means of affecting the ability to temporarily (for the duration of the Bash node session) modify the $PATH variable.
This same issue appears in my attempts with Cmdwinput node and External Tool node. All of them put you in $PATH jail.
With approach #2 I noticed a possible cause of the command not found. Using the Bash Node to get all env variables it gave back a PATH variable. However, using the Java Snipped the PATH variable was not found. Could it be that the PATH variable is not properly setup / defined and Knime respectively Eclipse falls back to a default?
I put all bits and pieces in this workflow together:
NOTE: There is a mistake with the Java Snippet which I noticed only after upload. Will update the workflow once resolved.
There are a few additional interesting findings as well. Using the whereis YOUR-CMD command to locate the executable the commands which do NOT work still could be found. The where YOUR-CMD (without “is”) command also works in the terminal but not in Knime.
Just for the record. Thanks to @carstenhaubold there is a Python based approach of executing bash commands.
Unfortunately, though, it has the same issue that some commands are not found. That pretty much makes it abundantly clear that the PATH variable difference between Knime / Eclipse and vs. user under which it runs is at fault.