[fpc-pascal] run pascal programs as scripts
Henry Vermaak
henry.vermaak at gmail.com
Thu Mar 24 17:44:56 CET 2011
On 24 March 2011 16:06, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> Hi all,
>
> I would like to execute small pascal programs like normal unix
> scripts. For example:
>
> #!/usr/bin/instantfpc
> begin
> writeln('shebang executed');
> end.
>
> Has anyone already written a tool, that compiles and
> runs the program?
Using an idea I saw somewhere else, I've done this:
hcv at technical09:~/source/fpc_script$ ls -l
total 4
-rwxr-xr-x 1 hcv hcv 148 Mar 24 16:38 fpc_script.pp
hcv at technical09:~/source/fpc_script$ cat fpc_script.pp
// 2>/dev/null; fpc fpc_script.pp &> /dev/null && exec ./fpc_script "$@"; exit
program fpc_script;
begin
writeln('hi there, from a script!');
end.
hcv at technical09:~/source/fpc_script$ ./fpc_script.pp
hi there, from a script!
It would be nice to have #!fpc --run
Henry
More information about the fpc-pascal
mailing list