[fpc-pascal] run pascal programs as scripts
Henry Vermaak
henry.vermaak at gmail.com
Thu Mar 24 17:53:54 CET 2011
On 24 March 2011 16:44, Henry Vermaak <henry.vermaak at gmail.com> wrote:
> 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
Or even:
// 2>/dev/null; fpc fpc_script.pp &> build.log && exec ./fpc_script
"$@" || cat build.log; exit
More information about the fpc-pascal
mailing list