With Kornshell, it is easy to embed AWK and passing variables and vaules to the AWK program. It works as follows:
Code: Select all
STRING="Hello1 Hello2 Hello3"
awk -v VAR="$STRING" 'BEGIN {print VAR}'
Now, I want to do the same thing with newLisp. I have a main program in Kornshell and I want to pass some strings to a piece of newLisp code.
This line gives the same result as the AWK example just mentioned:
Code: Select all
newlisp -e "(silent (println \"Hello1 Hello2 Hello3\"))"
Code: Select all
NEWLISP_LINE='(println \"${STRING}\")(exit)'
newlisp -e $NEWLISP_LINE
Also other constructions do not work:missing parenthesis : "...(println "
Code: Select all
NEWLISP_LINE="(println $STRING)(exit)"
NEWLISP_LINE='(println $STRING)(exit)'
The workaround is to rewrite the main Kornshell program completely to newLisp, but then I have to convert over a 2000 lines of code. :-(
So, how can I embed newLisp code within a larger (shell) program, and pass values and variables to these codesnippets from the main program?
Thanks
Peter