[Openmcl-devel] Why cannot i use the shebang ?
jkordani at lsa2.com
Fri Aug 2 03:57:54 UTC 2013
Pascal is pulling your leg....
You are mixing metaphors. Your original script says that you want to use the shell to execute ccl, passing a script to load once starting up the image.
Your problem is that you are passing the current script that you're executing!!!!! You have a shell script, and are trying to feed it to ccl as a lisp source file. Pascal is right, in that the error message is very clear about why the ccl program has a problem with your input file. The overarching problem is that you're passing the ccl program the wrong kind of file. The metaphors you are mixing are "what do I need to do to start ccl" and "what do I need to do to run my code"
Just because you call your file .lisp doesn't mean that the shell is going to read the script and pass it to the proper program to execute. Nay, with a #!/bin/sh, the script file you made is going to pass to /bin/sh for execution first, and the first command that sh evaluates will be your call to execute ccl. So far so good.
What you need to do is separate everything else that is lisp code into its own file, or find a #! line that passes the script to ccl, like #!/home/username/ccl/fx86cl -Q -l
(your lisp script here)
So you either have two files:
exec ~/ccl/fx86cl -Q -n -l $1
and another file
and then you make your start-program.sh executable with chmod +x,
then to run everything,
this passes my-lisp-program.lisp as the first argument to your start-program.sh
the other way (and I haven't tried this, but it works like this with newlisp):
#!/path/to/ccl/fx86cl -Q -n -l
make lisp-program.... executable with chmod +x. and maybe this will work.
With the separation into two files, you get the ability to start your program on any OS (as long as your lisp code is platform independent)
because to migrate to windows, you make a batch file that looks like this
start c:\path\to\ccl\fx86cl.exe -Q -n -l %%1 <---my batch foo is weak, but you get the idea
While your lisp-program.lisp file stays the same!!!
Now on windows you invoke your program with
I hope this has been illuminating. Sorry to spoil your fun Pascal :-)
More information about the Openmcl-devel