I’m trying to pass data held in a list in the Sensetalk programming language to a bash script. How do I do that?
If you have an existing bash, I would recommend using a shell command:
If you are trying to use Eggplant to generate the bash script, you can put the commands directly into a file using file functions (e.g. put myBashCommands into file “/tmp/bashscript.sh”).
Thank you for the references and ideas.
Thanks Dave, that covers both use cases very nicely. I’m not sure though that those approaches would work when invoking a “headless” sensetalk script in a build pipeline (in a bash script) that needs to pass command line variables into the instance of the process? I suppose that could be done by writing them to a file that the SenseTalk script opens in the working directory, but that is a bit clumsy when there may be multiple instances of scripts running concurrently - passing linux/using argument vector (argc, **argv in C language) arguments would be highly desirable. So that, for example, we have a Git repository that users check into, and when they do a build pipeline runs that compiles their project, runs Eggplant scripts on it using the command line client, and then flags up any test results that are not nominal for inspection…
I suppose that could be done by writing them to a file that the SenseTalk script opens in the working directory, but that is a bit clumsy when there may be multiple instances of scripts running concurrently
The above is what I was trying to avoid. There is not really a clean way of doing this. So, we hard coded the variables into the bash scripts. Not the most ideal solution, but it works.
Could you share a snippet? I’m intrigued, I would have thought that you didn’t need to hard code them in the bash script. I’m a linux bash programmer fwiw Stephen - the critical programming API call would seem to be getenv(3) in the linux manual, or execve (2), which ST would need to have a wrapping call for. It presumably does for execve because it can fork and execute a child process.