On Thu, 24 Mar 2011 16:53:54 +0000 Henry Vermaak <henry.verm...@gmail.com> wrote:
> On 24 March 2011 16:44, Henry Vermaak <henry.verm...@gmail.com> wrote: > > On 24 March 2011 16:06, Mattias Gaertner <nc-gaert...@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@technical09:~/source/fpc_script$ ls -l > > total 4 > > -rwxr-xr-x 1 hcv hcv 148 Mar 24 16:38 fpc_script.pp > > > > hcv@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 Nice idea. I didn't know the // 2>/dev/null trick. It does not work with tcsh. The working directory must be '.'. The temp files should go to another directory. Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal